libtool
[Top][All Lists]
Advanced

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

Re: Understanding -static


From: Peter O'Gorman
Subject: Re: Understanding -static
Date: Sun, 09 Jan 2005 11:00:40 +0900
User-agent: Mozilla Thunderbird 1.0 (Macintosh/20041206)

Akim Demaille wrote:

Right.  But linking statically a dynamic library doesn't sound
absurd to me (but I may be naive here).  At least, it works fine
on GNU/Linux.

Perhaps libtool should complain that -static was specified and no  static
library was available in this case? How on earth does linux manage  this?


What is the problem actually?

Part of the problem is probably my total failure to understand why/how this works on GNU/Linux. Does libtool generate a wrapper script for the executable there? Or does it include the path to the libraries build time location in the rpath?

Since darwin does not yet have rpath the location that the shared library will be at after it is installed is stored in the executable (and other shared libraries), which means that a wrapper script would be required in this circumstance. I suppose the fact that the wrapper script is not generated is a bug :( It should be possible for libtool to figure out if it has both the -static flag and a shared library on the link line for and generate a wrapper script if that is the case, I'll need to look into it.


When I use gcc directly, I have a weird failure.

sulaco% g++ -o hw main.o -static ./.libs/libhw.dylib
ld: can't locate file for: -lcrt0.o

There is nothing like crt0 on my machine.

Apple does not support complete static linking, the best explanation I could find as to why is here: <http://lists.apple.com/archives/unix-porting/2004/Mar/msg00059.html>, Jim Magee, the author of that mail is, I believe, a lead developer in the kernel group at Apple.

Peter
--
Peter O'Gorman - http://www.pogma.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]