ADC Home > Reference Library > Technical Q&As > Tools > Darwin >

Static linking of user binaries on Mac OS X


Q: I'm trying to link my binary statically, but it's failing to link because it can't find 'crt0.o.' Why?

A: Static linking of user binaries is not supported on Mac OS X. Tying user binaries to the internal implementation of Mac OS X libraries and interfaces would limit our ability to update and enhance Mac OS X. Instead, dynamic linking is supported (linking against crt1.o automatically instead of looking for crt0.o, for example).

We strongly recommend that you consider the limitations of statically linking very carefully, and consider your customer and their needs, plus the long-term support you will need to provide. Apple provides support and attempts to insure complete compatibility through the published APIs, but cannot insure that compatibility in a statically linked project. Any change to Mac OS X, in a system update, security update, or major revision, may break statically linked code.

If your project absolutely must link statically and need crt0.o, you can get the Csu module from Darwin and try building crt0.o statically. Please bear in mind that you must then clearly specify to your customers the compatibility risks involved in installing a product that relies on statically linked code.


[Feb 07 2002]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.