开发者

Creating app for old mac from new mac machine?

I am writing an sample app on MAC OSX 10.6 having gcc version 4.2. I am compiling app using gcc version 4.2 . It is working fine on the same machine but on MAC OSX 10.5 (gcc 4.0) it is not working. how can I compile it on 10.6 so it will also work on old machine ?

I am getting these error

dyld: unknown required load command 0x80开发者_开发问答000022
Trace/BPT trap

command I used to build is

gcc -m32 main.cc 


The application was incorrectly built on OS X 10.6 machine for a 10.5 machine. The developer can fix this by considering three things:

Using the correct compiler parameters:
gcc-4.2 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk ...

Using the correct linker settings (setting environment variable before link command). This is required, so that the OS X 10.6 linker will not use the loader command 'LC_DYLD_INFO_ONLY' (=0x80000022), because OS X 10.5 does not understand this command:

export MACOSX_DEPLOYMENT_TARGET=10.5
(or   setenv MACOSX_DEPLOYMENT_TARGET=10.5)

After this is fixed, one can check if the application was correctly built for OS X 10.5 by running 'otool':

otool -l binary

The correct binary should not contain any 'LC_DYLD_INFO_ONLY' load commands (only 'LC_DYLD_INFO' commands).

(also see my blog article http://grauonline.de/wordpress/?p=71 )


-arch i386 -Wl,-macosx_version_min,10.5 will help; I don't know for certain if they'll be sufficient, though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜