John Carter wrote:
On Fri, 28 Mar 2008, Aidan Gauland wrote:

Last time I had a go at this I found that static is deprecated.... the
libc folks like Uli Drepper seem to be pushing _hard_ on the idea that
you should keep it dynamically linked. In fact, chunks of the glibc
won't work properly if you don't.

Sigh! Personally I hate this, but I when I try fight it I seem to be
pissing upwind in a Canterbury gale...

Options for you....

0) Trust the distro to have the right .so. This seems to be the
   preferred appoach.
For this project (The Pipmak Game Engine -- pipmak.sourceforge.net ), the project leader (it's a relatively small project) wants to keep the pre-compiled packages (and by that, I mean a tarball on Linux, zip on Winblows, .dmg on Mac) as self-contained as possible. Currently, the one for Linux has only two libraries linked in statically, but I'm trying to change the Makefile, so it either links most statically, or all shared, but I think I'll try the solution below.


1) Deliver the .so's with the application and use LD_LIBRARY_PATH or
LD_PRELOAD environment variables in a wrapper script. (eg. Firefox
isn't a binary, it's a script. firefox-bin is the binary.)
I think I'll shoot for this one.  Are there any details I should know about?


2) Create a libwhatever.a and explicitly link against -lwhatever.a
Tried that.  It just links all in dynamically.


3) Bugger around with the -Wl, option to talk directly to ld instead
of via the gcc wrapper. (Hint the program gcc is just a wrapper that
parses options, adds some more and invokes the real preprocessor /
compiler / assembler / linker.)
Nuts!  Didn't work!  Got error:
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status


Let me know how you get on.

Another handy resource for this class of question is the gcc-help
mailing list. (Don't try the "gcc" mailing list, that's for
development of gcc and your ears tend to get crisped if you ask there
about using gcc rather than writing gcc.)





John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : [EMAIL PROTECTED]
New Zealand



Reply via email to