gcc2.7.2 dynamic linking?
Hsin-Yu Sidney Li
LIH at cliffy.polaroid.com
Sun Mar 3 14:11:12 EST 1996
Hi,
This is a follow-up on the post I put out last week:
>
> Hi,
>
> I have just upgraded from gcc 2.7.0 to 2.7.2 (and upgraded to binutil
> 2.6.0.2, libc-5.2.18, ld.so-1.7.14). I tried to compile some X
> programs, and found that the executables were statically linked.
> I.e., when I did
>
> % ldd -v oneko
>
> "oneko" was linked only to libc and libm, but not to the libX stuff.
> The compiliation was done as:
>
> % cc -O2 -m486 -ansi -I/usr/X11R6/include -Dlinux -D__i386__
> -D_POSIX_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE -DFUNCPROTO=15
> -DNARROWPROTO -DSHAPE -I/usr/local/include -c oneko.c -o oneko.o
> % /bin/rm -f oneko
> % cc -o oneko -O2 -m486 -ansi -L/usr/X11R6/lib oneko.o
> -L/usr/local/lib -lXExExt -lXext -lX11 -lm
> -Wl,-rpath,/usr/X11R6/lib
>
> I tried adding a "-Wl,-Bdynamic" to the last command, but that didn't
> do any good. I had compiled this with gcc 2.7.0 just a few months ago
> (with the exact same option flags), and it was linked dynamically.
> The executable will run all right, but it is HUGE (since it links
> statically; size is 221560 instead of 35568). Do I need to add
> something to tell it to link dynamically? Thanks in advance!
>
> Sidney Li
> Polaroid Corp.
> lih at polaroid.com
>
It turns out that the problem is in the binutils package. When I
"downgraded" to binutils 2.5.2l.17, the programs linked correctly to
libX11, etc. I skimmed through the release notes, but this didn't
seem to be mentioned. Just thought that this might be interesting to
other people as well. (BTW, I am running kernel 1.2.13).
Regards,
Sidney Li
Polaroid Corp.
lih at polaroid.com
More information about the Discuss
mailing list