Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gcc 2.7.2 dynamic linking?



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






BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org