From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id E2E9F6EC60; Thu, 1 Apr 2021 02:56:06 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org E2E9F6EC60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617234967; bh=Oer43jwSJRXhJUFDQwvXnRek5MG+fAU55JIdxB1EppM=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Tdr+p2qDt0yC55fNwQ18s178BGiP9hzQidGydCKonMoGRuVvdMpi7auweLq0x+E37 joCa4jVv0b0yWsYtdi8XB5dujITFi2PdnIJd6Wf1IiYn8PTd9pcNzPQs5Ssx0ECFcK oNSgFvbXUYjODRTEPXAEJ54IJccc779KgKoI0NuA= Received: from smtp42.i.mail.ru (smtp42.i.mail.ru [94.100.177.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 3B82D6EC60 for ; Thu, 1 Apr 2021 02:56:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3B82D6EC60 Received: by smtp42.i.mail.ru with esmtpa (envelope-from ) id 1lRkgu-0002VI-GS; Thu, 01 Apr 2021 02:56:04 +0300 Date: Thu, 1 Apr 2021 02:56:26 +0300 To: Roman Khabibov Cc: tarantool-patches@dev.tarantool.org Message-ID: <20210331235626.wlocbeps5cn7p6za@tkn_work_nb> References: <20210319141308.98726-1-roman.habibov@tarantool.org> <20210319141308.98726-2-roman.habibov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210319141308.98726-2-roman.habibov@tarantool.org> X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9ED7173E37F4E32947A0146560F8BA70927CAA5B950F38D9F182A05F538085040C5F6C0E1F8DB2B2367B4159FB64DB3119DA28A7730A6C53C98D7BEF8FD022CC2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77AA33865E80AF043EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D3219148F76DED538638F802B75D45FF914D58D5BE9E6BC131B5C99E7648C95CE99938B3FD79E1DFA7B94573845CBA12A5C4ABED0EA15884A471835C12D1D9774AD6D5ED66289B5278DA827A17800CE77A825AB47F0FC8649FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C353FA85A707D24CADCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C2249632B93D3E002A4F776E601842F6C81A12EF20D2F80756B5F7E9C4E3C761E06A776E601842F6C81A127C277FBC8AE2E8BD821F6303F073B1F3AA81AA40904B5D9DBF02ECDB25306B2201CA6A4E26CD07C3BBE47FD9DD3FB595F5C1EE8F4F765FCA83251EDC214901ED5E8D9A59859A8B621848445AA7AC3B6089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24A6D60772A99906F8E1CD14B953EB46DFE97F054E1792449355D89D7DBCDD132 X-C1DE0DAB: 0D63561A33F958A55D78E08081F5B81958B2B559496072D95A8E5959099EE1FCD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3455049D7B43D89D64FCE81D6A7E02D2B9BA38BDC7FFF898B1FACE5399B5FA17AB4BFDAA73753A88D51D7E09C32AA3244C6DB1B1EEDDB426564A1DF0C0BC4CFC47FE8DA44ABE2443F7729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojetunDCtJ20LY5S2QPOGqvA== X-Mailru-Sender: FFAA8E4AEE17E37C3731A083A1A85ADE7397CFA280CF01B17B6B5683F1E6B442B7EA9FE7735C3DBFC664A44C781FCEA7C77752E0C033A69EDF9F2CE1E9CF805D8CD356D4F938FF726C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/3] build: export libCURL symbols X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Alexander Turenko via Tarantool-patches Reply-To: Alexander Turenko Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 . 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.