[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [EXTERNAL] Re: Unhelpful automatic 3rd-party library linkage

From: Oleg Smolsky
Subject: Re: [EXTERNAL] Re: Unhelpful automatic 3rd-party library linkage
Date: Tue, 29 Jun 2021 15:40:37 -0700

On Tue, Jun 29, 2021 at 3:22 PM Bob Friesenhahn <> wrote:
On Tue, 29 Jun 2021, Oleg Smolsky wrote:
> It looks like GCC9 references come from libzmq:
> $ ldd /opt/3p/lib/ | grep libstd
> => /opt/gcc-9/lib/../lib64/
> (0x00007f95f8d9f000)
> Obviously the 3rd-party library was built a while ago with GCC9. At the
> time it was linked to the compiler's runtime... but now the main
> application has moved to GCC11 and I'm linking to the runtime that is
> correct right now.
> It looks like automake/libtool try to be helpful and check the library's
> dependencies... but that gets in the way as the new libstdc++ is a strict
> superset of the old one. They maintain ABI compatibility and so scenarios
> like these are supported.

Are you absolutely sure that the above is true?  You specified c++17
when compiling your application.  Are the libstdc++ ABI's the same
across GCC versions and C++ language versions?

Well, I want to claim that I am absolutely sure :) My understanding is that there have been no ABI breaks in the GCC/libstdc++ ever (even noting the 5.x move to the Standard-compliant std::string). The general principle is to let people/distros upgrade gcc/libstdc++ in the OS and let the old apps continue running.

> Is there a way to suppress dependency tracking for the 3rd-party libraries?
> I wish Libtool/automake was not trying to be smart and simply passed
> "-lzmq" directly to the linker. Yet instead, the actual .so file is
> discovered and then its is linked. This is just wrong for the
> scenario at hand.

Assuming that the whole system does not have these directories in the
default search path (e.g. via ldconfig), it appears that this is a
recorded implicit dependency which is encoded in the library itself.
The only way to remove such an implicit dependency is to rebuild the
library (e.g. with different options.

If the persons who delivered the compilers to you expected that the
C++ library was truely reusable, then they would not have have put
everything under /opt/gcc-foo directories (also suggesting that these
directories are removable).  Instead they would have put the C++
run-time libraries in a standard system location.  For example, under
Ubuntu Linux, I see that is at
/usr/lib/x86_64-linux-gnu/ which is a common system

:) I am the person who maintains the compilers (installed into /opt/gcc-xx) and 3rd-party libs (installed into /opt/3p) at our shop. I don't care to update the system's compiler or libs as we don't use them at all. That is, our build system uses our compiler and only links to the 3rd-party dependencies from /opt.

As far as I am aware, there is no option to request that libtool
not perform the full linkage that it does.  A common work-around is to
remove the ".la" files that libtool produces and installs.

It is possible that GCC itself is pre-programmed (e.g. via the spec
file) to record this information when it links with the C++ standard
Right, I figured this very point out just a couple hours ago - the extra flags/libs (along with the -lzmq transformation) come from the ".la" file. I've rebuilt the lib, purged the file and things look good now for my build.

Could you shed some light on how this .la file is supposed to be used? I see that it tries to be helpful by capturing the dependencies... but it seems to destroy the standard `-lfoo` contract. IE it appears that it reduces the level of abstraction needlessly for artifacts that are distributed/stored. Is this ".la" thing meant only for build systems where the whole tree is built from scratch at the same time?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]