5 Replies Latest reply: Feb 3, 2012 1:14 PM by etresoft
Jongware Level 2 Level 2 (265 points)

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)
  • etresoft Level 7 Level 7 (26,425 points)

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

  • Jongware Level 2 Level 2 (265 points)

    You mean when I run it on SL? I'll check tomorrow, at work we still have SL, while at home I'm on Lion.

     

    Is it as simple as adding this library on compiling, or (I'm just guessing here) will it then throw me a next missing library error?

  • Jongware Level 2 Level 2 (265 points)

    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?

  • Jongware Level 2 Level 2 (265 points)

    Before I forget: so all it really needs is that incantation that I tried first? No need to mess around with 32/64 flags, or anything else?

  • etresoft Level 7 Level 7 (26,425 points)

    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