Selecting the OSX SDK
While I was trying to build a fat binary for Tiger I had to realize that just adding the “-arch” option is not good enough. If you need to link against a framework it might result in missing symbols and lots of linker errors.
/usr/bin/ld: warning /System/Library/Frameworks/Security.framework/Security cputype (18, architecture ppc) does not match cputype (7) for specified -arch flag: i386 (file not loaded)
/usr/bin/ld: warning fat file: /usr/lib/gcc/i686-apple-darwin8/4.0.1/../../../libSystem.dylib does not contain an architecture that matches the specified -arch flag: i386 (file ignored)
...
Turns out the problem was that I had to point gcc to the right SDK.
gcc authexec.c -arch i386 -o authexec.i386 -framework Security -isysroot /Developer/SDKs/MacOSX10.4u.sdk