I am developing a program on OSX 10.6.4 (Snow Leopard), and I want to be able to run the compiled product on other Intel Macs, some of whom may not have XCode isntalled.
To simplify things, I first wrote a Hello World program.
#include<stdio.h>
int main() {
printf("Hello world!\n");
return 0;
}
If I compile it as
gcc -static prog.c
I get the folllowing error:
ld: library not found for -lcrt0.o
I don't know where to find this library. Now, some people have mentioned that I should not compile statically on macs since the system shared libraries should be available everywhere (third party libraries can be manually linked). However, when I try to run this Hello World program on another mac, I get the folowing error:
dyld: unknown required load command 0x80000022
Trace/BPT trap
So, how do you compile a program on mac so that it can be distributed? I am not having architecture issues, as most computers I am interested in are Intel Macs.