How can i create a static build of a .c file on Mac OS X ? When i try:
gcc -o test Main.c -static
I get:
ld: library not found for -lcrt0.o
collect2: ld returned 1 exit status
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is not supported in Mac OS X’s gcc:
http://discussions.apple.com/message.jspa?messageID=11053384
And http://developer.apple.com/library/mac/#qa/qa2001/qa1118.html
Update: The prohibited is a static binary. But you still can compile some static library and use it with you another program. Program will be linked statically with your library, but other libraries like libc will be dynamic, so program will be a dynamic executable.