I'm confused or statically linked libraries
-----BEGIN PGP SIGNED MESSAGE-----
I was rebuilding some packages since there are some I prefer to do on my
own. I noticed that ssh uses zlib and gmp. zlib is libc6 already and
no problem. I grabbed the sources to gmp and went to build it for
libc6. I added -D_REENTRANT and -fPIC (I figured I'd deal with the
static lib later.) and built the library. I made sure that it was
linked with -lc so that it would know the correct libc to use.
Unfortunately, after I did that, libgmp was still statically linked. I
was confused since I thought I'd read a message that that was how it was
done. I grabbed the zlib source and built it since I knew it was
dynamically linked. It did similar things yet it came out dynamically
linked. I was confused since it seemed that the two were doing the same
thing. I'm hoping some of the ELF/libc folks on here can help.
Here's the sample compiler/linker/ldd lines:
gcc -O2 -c -I. -Impn -I. -O3 -D_REENTRANT -fPIC extract-double.c
gcc -O2 -c -I. -Impn -I. -O3 -D_REENTRANT -fPIC insert-double.c
gcc -shared -Wl,-soname,libgmp.so.2 -lc -o libgmp.so.2.0.2 *.o */*.o
{3}[1]~SRC/debian/local/gmp/gmp-2.0.2 kitchen:-) ldd libgmp.so.2.0.2
statically linked
gcc -c -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes \
-Wmissing-prototypes -D_REENTRANT -fPIC -o shared/inffast.o inffast.c
gcc -c -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion -Wstrict-prototypes \
-Wmissing-prototypes -D_REENTRANT -fPIC -o shared/infutil.o infutil.c
gcc -shared -Wl,-soname,libz.so.1 -lc -o ../libz.so.1.0.4 adler32.o compress.o \
crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infblock.o \
inftrees.o infcodes.o infutil.o inffast.o
{4}[0]~SRC/debian/local/zlib/zlib-1.0.4 kitchen:-) ldd libz.so.1.0.4
libc.so.6 => /lib/libc.so.6 (0x40011000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
BTW, I noticed that some libraries come up as (ELF-libc[56]) and some as
(ELF). My guess is that the first type have been linked with -lc and
know which libc there are based on and the second isn't.
Thanks,
Darren
- --
<torin@daft.com> <http://www.daft.com/~torin> <torin@debian.org> <torin@io.com>
Darren Stalder/2608 Second Ave, @282/Seattle, WA 98121-1212/USA/+1-800-921-4996
@ Sysadmin, webweaver, postmaster for hire. C/Perl/CGI programmer and tutor. @
@ Make a little hot-tub in your soul. @
-----BEGIN PGP SIGNATURE-----
Version: 2.6.3
Charset: noconv
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface
iQCVAwUBNF2ZI44wrq++1Ls5AQFoiAP+PCW7FZgTXFZMrL/CFASEAPGEOed1hUy1
NSKJ5uwvzyLIoxMWzhu4nrqeg9XZm+usP+IDlQMwUTbqZlSoLLKNay26Hhlsl4tl
UZDHhht/3APIF8k/nNRTCiYtly9UeyhC/BrUhH8HYVv/qb5hUO5IXpiF5JSJ2Uj6
VMrkCaAyY84=
=Nbpb
-----END PGP SIGNATURE-----
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-devel-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: