Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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)

Posted on Feb 2, 2012 12:10 PM

Reply
Question marked as Best reply

Posted on Feb 2, 2012 2:09 PM

Did it tell you what library it wanted? I just compiled a HelloWorld on Lion and it worked fine on 10.6.

5 replies

Feb 3, 2012 1:11 PM in response to Jongware

Thanks Etre, you put me on the right track -- that is, verifying my targeted system again. Lo & behold, I was on a wild goose chase here, and you never guess how:


The one single machine I tried it on at work (6 macs) was the one nobody uses on a daily basis. It happened to be the single one that still was running Leopard. Hence, my Snow Leopard build didn't run on it ...


For what it's worth, at this time, this is the error it threw:


Last login: Fri Feb  3 13:45:02 on ttys004
/Volumes/USB\ DISK/PngIconImg_XC ; exit;
Macintosh:~ developer$ /Volumes/USB\ DISK/PngIconImg_XC ; exit;
dyld: unknown required load command 0x80000022
Trace/BPT trap
logout


Just for funsies, I tried to locate MacOSX10.5.sdk (Leopard) but it seems that's not included in this XCode installation. No way to go but forward, eh? 🙂

Feb 3, 2012 1:14 PM in response to Jongware

Jongware wrote:


Just for funsies, I tried to locate MacOSX10.5.sdk (Leopard) but it seems that's not included in this XCode installation. No way to go but forward, eh? 🙂

You need to keep your old SDKs around if you want to keep support for older systems. You may be able to get that from Xcode 3.2.6. I say upgrade that thing and move on 🙂

Targeting SL with gcc/clang on Lion

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.