Tarantool development patches archive
 help / color / mirror / Atom feed
From: Alexander Turenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Roman Khabibov <roman.habibov@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/3] build: export libCURL symbols
Date: Thu, 1 Apr 2021 02:56:26 +0300	[thread overview]
Message-ID: <20210331235626.wlocbeps5cn7p6za@tkn_work_nb> (raw)
In-Reply-To: <20210319141308.98726-2-roman.habibov@tarantool.org>

On Fri, Mar 19, 2021 at 05:13:06PM +0300, Roman Khabibov wrote:
> Export the symbols to tarantool executable in the case of libCURL
> included as bundled library.
> 
> This patch is just 1.10 adaptation of the original commit 9fc57c4
> performed by Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com>.

The commit hash you reference is not reachable from the master branch.

Aside of this, some logic arrives from
47c19eeb4f67cb7257ce32542443c09410b6e752 ('build: don't re-export
libcurl.so/dylib symbols').

> diff --git a/extra/curl_symbols b/extra/curl_symbols
> new file mode 100755
> index 000000000..89e247a00
> --- /dev/null
> +++ b/extra/curl_symbols
> @@ -0,0 +1,81 @@
> +curl_easy_cleanup
> +curl_easy_duphandle
> +curl_easy_escape

It is the part of extra/exports, so I would name it
extra/exports_libcurl.

I would also keep Yaroslav's comment at the start:

 | # The following list was obtained by parsing libcurl.a static library:
 | # nm libcurl.a | grep -oP 'T \K(curl_.+)$' | sort
 |
 | curl_easy_cleanup
 | curl_easy_duphandle
 | <...>

> diff --git a/extra/mkexports b/extra/mkexports
> index 145e5b8ce..c10f20ae4 100755
> --- a/extra/mkexports
> +++ b/extra/mkexports
> @@ -2,22 +2,30 @@
>  # $1 - in  file
>  # $2 - out file
>  # $3 - os
> -# $4 - export templates
> +# $4 - is bundled curl on/off flag
> +# $5 - curl symbols
> +# $6 - export templates

I would just pass one or two files (extra/exports,
extra/exports_libcurl) in $1: it'll be easier to read.

My diff (from 1.10):

 | diff --git a/extra/mkexports b/extra/mkexports
 | index 145e5b8ce..95c3f8eed 100755
 | --- a/extra/mkexports
 | +++ b/extra/mkexports
 | @@ -1,5 +1,5 @@
 |  #! /bin/sh
 | -# $1 - in  file
 | +# $1 - in file(s)
 |  # $2 - out file
 |  # $3 - os
 |  # $4 - export templates
 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
 | index 1e840aab9..db771cce9 100644
 | --- a/src/CMakeLists.txt
 | +++ b/src/CMakeLists.txt
 | @@ -301,6 +301,13 @@ if(BUILD_STATIC)
 |      endif()
 |  endif()
 |  
 | +set(exports_file_sources ${CMAKE_SOURCE_DIR}/extra/exports)
 | +if (EXPORT_LIBCURL_SYMBOLS)
 | +    set(exports_file_sources ${exports_file_sources}
 | +        ${CMAKE_SOURCE_DIR}/extra/exports_libcurl)
 | +endif()
 | +string(REPLACE ";" " " exports_file_sources "${exports_file_sources}")
 | +
 |  # Exports syntax is toolchain-dependent, preprocessing is necessary
 |  set(exports_file ${CMAKE_BINARY_DIR}/extra/exports.${CMAKE_SYSTEM_NAME})
 |  add_custom_target(preprocess_exports
 | @@ -309,7 +316,7 @@ add_custom_command(
 |      OUTPUT  ${exports_file}
 |      DEPENDS ${CMAKE_SOURCE_DIR}/extra/exports
 |      COMMAND ${CMAKE_SOURCE_DIR}/extra/mkexports
 | -            ${CMAKE_SOURCE_DIR}/extra/exports
 | +            ${exports_file_sources}
 |              ${exports_file} ${CMAKE_SYSTEM_NAME}
 |              ${EXPORT_LIST}
 |  )

----

Just for the record: I also tried another implementation variant:

 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
 | index 1e840aab9..6804ba301 100644
 | --- a/src/CMakeLists.txt
 | +++ b/src/CMakeLists.txt
 | @@ -284,8 +284,9 @@ if(BUILD_STATIC)
 |              list(APPEND EXPORT_LIST ${SYMBOLS_LIB})
 |              # set variable to allow rescan (CMake depended)
 |              set(SYMBOLS_LIB "SYMBOLS_LIB-NOTFOUND")
 | -        elseif (${libstatic} STREQUAL bundled-libcurl OR
 | -                ${libstatic} STREQUAL bundled-ares)
 | +        elseif (${libstatic} STREQUAL bundled-libcurl)
 | +            # Handled below.
 | +        elseif (${libstatic} STREQUAL bundled-ares)
 |              message("We don't need to export symbols from statically linked ${libstatic}, skipped")
 |          else()
 |              message(WARNING "${libstatic} should be a static")
 | @@ -301,10 +302,24 @@ if(BUILD_STATIC)
 |      endif()
 |  endif()
 |  
 | +# Expose libcurl symbols.
 | +if(ENABLE_BUNDLED_LIBCURL OR BUILD_STATIC)
 | +    set(reexport_libraries ${reexport_libraries} ${CURL_LIBRARIES})
 | +
 | +    if (ENABLE_BUNDLED_LIBCURL)
 | +        get_target_property(libstatic bundled-libcurl IMPORTED_LOCATION)
 | +        string(REGEX REPLACE "libcurl.a" "libcurl.so" libdynamic ${libstatic})
 | +    else()
 | +        find_library(libdynamic NAMES curl)
 | +    endif()
 | +
 | +    set(EXPORT_LIST ${EXPORT_LIST} ${libdynamic})
 | +endif()
 | +
 |  # Exports syntax is toolchain-dependent, preprocessing is necessary
 |  set(exports_file ${CMAKE_BINARY_DIR}/extra/exports.${CMAKE_SYSTEM_NAME})
 |  add_custom_target(preprocess_exports
 | -                  DEPENDS ${exports_file})
 | +                  DEPENDS ${exports_file} build_bundled_libs)
 |  add_custom_command(
 |      OUTPUT  ${exports_file}
 |      DEPENDS ${CMAKE_SOURCE_DIR}/extra/exports

(At least it works for libcurl bundling, but I didn't verified it with static
build.)

However explicit listing of public libcurl symbols looks easier to understand
and in tune with master.

  reply	other threads:[~2021-03-31 23:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 14:13 [Tarantool-patches] [PATCH 0/3] Export curl symbols, enable smtp and install headers Roman Khabibov via Tarantool-patches
2021-03-19 14:13 ` [Tarantool-patches] [PATCH 1/3] build: export libCURL symbols Roman Khabibov via Tarantool-patches
2021-03-31 23:56   ` Alexander Turenko via Tarantool-patches [this message]
2021-04-09 19:54     ` Roman Khabibov via Tarantool-patches
2021-04-01  0:01   ` Alexander Turenko via Tarantool-patches
2021-03-19 14:13 ` [Tarantool-patches] [PATCH 2/3] build: enable smtp in libCURL Roman Khabibov via Tarantool-patches
2021-04-01  0:52   ` Alexander Turenko via Tarantool-patches
2021-04-09 19:54     ` Roman Khabibov via Tarantool-patches
2021-03-19 14:13 ` [Tarantool-patches] [PATCH 3/3] build: install libCURL headers Roman Khabibov via Tarantool-patches
2021-04-01  0:10   ` Alexander Turenko via Tarantool-patches
2021-04-09 19:54     ` Roman Khabibov via Tarantool-patches
2021-04-13 13:14 ` [Tarantool-patches] [PATCH 0/3] Export curl symbols, enable smtp and install headers Leonid Vasiliev via Tarantool-patches
2021-04-14 17:52   ` Roman Khabibov via Tarantool-patches
  -- strict thread matches above, loose matches on Subject: below --
2021-03-18 11:33 [Tarantool-patches] [PATCH 1/3] build: export libCURL symbols Бабин Олег via Tarantool-patches
2021-03-18  8:51 [Tarantool-patches] [PATCH 0/3] Install iibCURL headers and export libCURL symbols for 1.10 Roman Khabibov via Tarantool-patches
2021-03-18  8:51 ` [Tarantool-patches] [PATCH 1/3] build: export libCURL symbols Roman Khabibov via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210331235626.wlocbeps5cn7p6za@tkn_work_nb \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=roman.habibov@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/3] build: export libCURL symbols' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox