[patch] build shared libraries
Peter S. Mazinger
ps.m at gmx.net
Mon Sep 5 11:54:23 UTC 2005
On Mon, 5 Sep 2005, Bernhard Fischer wrote:
> Hi,
>
> Attached patch adds CONFIG_BUILD_LIBRARIES.
haven't tested it, only looked at the patch:
1. for shared libs the objects should all be built PIC (use -fPIC instead
of -fpic -commented currently-, -fpic is probably meaningful only on ppc)
2. use -Wl,-z,defs when linking the libs, to assure that everything is
defined
3. soname is only meaningful if the libs have versioning, like
libb-1.0.1.so, soname could be libb.so.1 (some would use as libname
libbb.so.1.0.1 and soname libbb.so.1), versioning would help if
external apps are built against these libs and/or if ABI changes.
>
> If set, lib*.a will be also build as shared libraries:
> ./libbb/libbb.so
> ./libpwdgrp/libpwdgrp.so
> ./archival/libunarchive/libunarchive.so
> ./networking/libiproute/libiproute.so
> ./coreutils/libcoreutils/libcoreutils.so
>
> If CONFIG_STATIC is set (which is the default), the busybox binary will
> use the static libs as before.
>
> If CONFIG_STATIC is not set, busybox will link against the shared
> variants of the libraries (1).
>
> make install installs (currently, i'm not against changing this) both
> dynamic and static variants of the libraries into $PREFIX/lib[64].
>
> This patch is ment as an RFC. It worked flawlessly in my cursory
> testing so far.
> Comments?
>
>
>
> 1)
> # ldd bin/busybox
> libunarchive.so => /lib/libunarchive.so (0x40018000)
> libiproute.so => /lib/libiproute.so (0x400e2000)
> libpwdgrp.so => /lib/libpwdgrp.so (0x400f0000)
> libcoreutils.so => /lib/libcoreutils.so (0x400f3000)
> libbb.so => /lib/libbb.so (0x400f5000)
> libdl.so.2 => /lib/tls/libdl.so.2 (0x40105000)
> libm.so.6 => /lib/tls/libm.so.6 (0x40108000)
> libcrypt.so.1 => /lib/tls/libcrypt.so.1 (0x4012b000)
> libc.so.6 => /lib/tls/libc.so.6 (0x40158000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> # ls -l bin/busybox
> -rwxr-xr-x 1 0 0 739044 Sep 5 09:38 bin/busybox
I would be interested how big the libs are?
>
> Annotations:
> a) There are two files in libbb which use libcrypt: correct_password.c
> and pw_encrypt.c. Because of this libbb.so itself has to link against
> libcrypt. Is this intended, given that there is libpwdgrp?
as I understand it, busybox used the version provided by *libc, libpwdgrp
is meant for systems lacking libcrypt
Peter
>
>
> b) every single Makefile.in seems to "handcode" the rule to build static
> archives ($(AR) $(ARFLAGS) $@). The patch adds a generic rule to build
> archives. This rule would be used if one specifies just the
> libname.a: myobj1.o myobj2.o
> dependencies without the redundant "$(AR) $(ARFLAGS)..." lines in all
> Makefile.in's. If a Makefile still has a separate Rule for building the
> archives, this specific Rule would be used instead of the generic one
> from Rules.mk.
> I changed the Makefiles for the libs which now are also built dynamically
> and left the other alone for now. I, personally, don't see a good reason
> not to ditch all remaining specific rules for building the archives but
> would suggest to add the generic rule in one place (like this patch
> does) and peruse this rule.
>
>
>
>
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2
More information about the busybox
mailing list