gcc 2.7.2 dynamic linking?
Hsin-Yu Sidney Li
LIH at cliffy.polaroid.com
Thu Feb 29 15:00:11 EST 1996
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
More information about the Discuss
mailing list