What is the general way to work with library dependencies when building with compilers other than the target distributions?

If you say that your project is built with one version of the C ++ compiler, and its potential target system provides shared libraries created with another version, how is this usually suitable? In particular, this is a question about libstdc ++.

When something is built inside the same distribution (for example, on Linux, etc.), it is quite simple - everything is built with the same compiler. But what about projects like Mozilla Firefox that deliver a binary supposedly compatible with many potential objects? I know that one way to do this is to statically link C ++ dependencies, which reduces ABI incompatibility issues and limits external linking to only a few C libraries, but when I look at the actual Firefox binary (from the Mozilal collection for Linux x86_64), I see it

ldd firefox linux-vdso.so.1 (0x00007fff561fc000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff868c9f000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff868a9b000) librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007ff868892000) libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007ff868587000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff868286000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff86806f000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff867cc6000) /lib64/ld-linux-x86-64.so.2 (0x00007ff868ee8000) 

Here, Firefox dynamically binds to libstdc ++. So, how can it work in different versions of libstdC ++ or just assumes compatibility with ABI and what is it?

+7
c ++ linux
source share
1 answer

The usual way ...

  • The developer / developer decides which (shared) libraries to use. Here you can specify a static link (-> build configuration).

  • The designer also chooses when and how to check the versions of the libraries used during assembly and / or the installation time and / or runtime.

  • A packer who creates a binary package for a specific purpose usually compiles the binary with the target tool chain and libraries.

  • If binary distribution is required for different purposes, then the package must provide a way to check the environment and libraries used during installation (-> installer). Either the installer or the application itself can check which tool chain was used to create the shared library, or either continue, or abort the error, or issue a warning and offer to continue.

  • The packer can provide a set of binary modules in the package, and the installer will select those that are necessary and compatible with this object and environment during installation.

This, of course, is lege artis and should be a general way to avoid any assumptions - and perhaps leave it to the user to ignore any warnings and try their luck.

0
source share

All Articles