Technical Q&A QA1118

Statically linked 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: Before discussing this issue, it's important to be clear about terminology:

Apple fully supports static libraries; if you want to create one, just start with the appropriate Xcode project or target template.

Apple does not support statically linked binaries on Mac OS X. A statically linked binary assumes binary compatibility at the kernel system call interface, and we do not make any guarantees on that front. Rather, we strive to ensure binary compatibility in each dynamically linked system library and framework.

If your project absolutely must create a statically linked binary, you can get the Csu (C startup) module from Darwin and try building crt0.o for yourself. Obviously, we won't support such an endeavor.

Document Revision History


Rewritten to clarify Apple's position on statically linked binaries.


New document that explains that statically linked binaries are not supported on Mac OS X.