Targeting SL with gcc/clang on Lion
If I need a short command line utility style program, I don't use XCode -- I simply type it into TextWrangler and compile it with a line like this:
gcc -xc -g -o target source.c
Programs compiled as such run nicely under Lion, but under Snow Leopard I get a dylib loader error (from memory: 0081h -- but I don't think that's the issue). If I compile the same program under Snow Leopard, it runs on both SL and Lion, so it's not a problem in the code.
What is the magic invocation to have gcc compile for SL? I tried this
gcc -xc -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min='10.6
and I got the same problem. (Based loosely on hints found elsewhere, by the way.) Is there more to this?
If I remember correctly, the previous XCode version could helpfully show gcc output flags, but it seems the current IDE 4.2 no longer does this ... Oh, and I just compiled using XCode and having "10.6" as target -- it compiled just fine. But of course I cannot test if it actually runs under SL until tomorrow ...
Mac OS X (10.7.2)