Gentoo Archives: gentoo-user

From: Andrea Conti <alyf@××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: static-libs
Date: Sun, 12 Sep 2010 07:47:41
Message-Id: 4C8C8578.5080009@alyf.net
In Reply to: Re: [gentoo-user] Re: static-libs by Al
1 > "DL libraries aren't really a different kind of library format (both
2 > static and shared libraries can be used as DL libraries);"
3
4 Library archives (.a) and shared objects (.so) differ in several ways.
5 Roughly speaking:
6
7 From a file format perspective, .a files are simple collections (man ar)
8 of independent compiled objects, while .so files are complete libraries
9 produced by the linker and contain additional information which tell the
10 dynamic linker (ld.so) how to load and share the code.
11
12 More importantly, code which is intended to be used in shared objects
13 must be compiled with specific options as position-independent code,
14 whereas code in an archive needs not.
15
16 You can't link dynamically against a library archive, so all DL code on
17 Linux must be compiled as a shared object, whether it's actually shared
18 or not (think plugins).
19
20 As for the static use-flag: don't use it, unless you have very good
21 reasons to do so. It will result in a system with larger binaries and in
22 many cases you will *not* get true statically-linked binaries (e.g. most
23 of the things which link against glibc). As for dynamic linking breakage
24 following upgrades, IMO portage and revdep-rebuild give good enough
25 support for fixing that.
26
27 andrea

Replies

Subject Author
Re: [gentoo-user] Re: static-libs Al <oss.elmar@××××××××××.com>
Re: [gentoo-user] Re: static-libs Enrico Weigelt <weigelt@×××××.de>