[tarantool-patches] Re: [PATCH] build: fix linking with static openssl library
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Sat Aug 24 00:07:59 MSK 2019
Thanks for the patch!
On 23/08/2019 04:08, Alexander Turenko wrote:
> System-wide dynamic libraries usually (always?) have NEEDED and RUNPATH
> tags in a dynamic section (as `readelf -d /usr/lib/lib<...>.so` shows),
> so when we link, say, with libssl.so, which depends on libz.so, a linker
> does not complain against unresolved symbols that can be found in Z
> library (if it is installed within a system).
>
> Things are different when we linking with a static library. Say, when we
> linking with libssl.a, which contains an unresolved symbol from Z
> library, a linker reports an error. It is not possible to store an
> information where to find unresolved symbols (NEEDED / RUNPATH) in a
> static library (AFAIK).
>
> We depend on three libraries that are depend on Z library: libcurl,
> libssl and libcrypto (two latter are part of OpenSSL). When one of those
> libraries is linked statically we should link with libz.so or libz.a
> (depending on BUILD_STATIC flag). The patch doing exactly this.
> Before this patch we add Z library to OPENSSL_LIBRARIES when
> BUILD_STATIC is enabled. It is not quite correct: we should do that when
> OPENSSL_USE_STATIC_LIBS is enabled. However we didn't experienced
> problems with static linking of libcurl (when BUILD_STATIC is enabled),
> because OPENSSL_LIBRARIES is added to CURL_LIBRARIES. This is a kind of
> side effect of dependency libcurl on OpenSSL and it is better to add
> libz explicitly to CURL_LIBRARIES (and OPENSSL_LIBRARIES) when
> appropriate.
Is it correct, that all the curl-related changes are just sugar not
related to the bug? Because I spent some time on attempts to understand,
how is curl related to the problem, but looks like in no way.
>
> Fixes #4437.
> ---
>
> https://github.com/tarantool/tarantool/issues/4437
> https://github.com/tarantool/tarantool/tree/Totktonada/gh-4437-fix-static-openssl-build-full-ci
>
> I more or less understood what is going on with all that linking stuff,
> but it would be glad if you'll check my wording around this topic.
Looks correct. Just a simple problem of a missing library during static linking
of a subsystem.
More information about the Tarantool-patches
mailing list