Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: statically linking



On Sun, 28 Jan 2001, Rob Braun wrote:

> What is the proceedure for trying to statically link binaries?

The procedure for trying or succeeding? :-)

(Sorry, couldn't resist...)

We don't ship static libraries on the system because we don't want folks
shipping statically linked applications (in case we decide to make changes
to the syscall interface or something silly like that).

Are you sure you need to do this?

That said, you can probably use the /usr/local/lib/system/libc_static.a
that gets spit out of the Libc project and the /usr/local/lib/crt0.o
startup code that comes out of Csu to make this work:

cc -static -c -o foo.o foo.c
cc -static -o foo foo.o -L/usr/local/lib/system -lc_static

This won't work for things that call gethostbyname() or sin(), though,
since we don't build a libinfo_static.a or libm_static.a by default. I
guarantee that this binary will not work across releases of Darwin or Mac
OS X. So, unless you're doing something useful to include in the OS (like
building a statically linked mv, ls, sh, mach_init, init in case you trash
dyld or libSystem...), you should avoid this.

matt.


References: 
 >statically linking (From: Rob Braun <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.