从新 mac 机器为旧 mac 创建应用程序?

发布于 2024-10-29 03:29:09 字数 323 浏览 9 评论 0原文

我正在 MAC OSX 10.6 上编写一个示例应用程序,其 gcc 版本为 4.2。 我正在使用 gcc 版本 4.2 编译应用程序。 它在同一台机器上工作正常,但在 MAC OSX 10.5 (gcc 4.0) 上它不起作用。 我怎样才能在 10.6 上编译它,以便它也能在旧机器上运行?

我收到这些错误

dyld: unknown required load command 0x80000022
Trace/BPT trap

命令,我用来构建的是

gcc -m32 main.cc 

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 0x80000022
Trace/BPT trap

command I used to build is

gcc -m32 main.cc 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

您的好友蓝忘机已上羡 2024-11-05 03:29:09

该应用程序错误地在 OS X 10.6 计算机上为 10.5 计算机构建。开发人员可以通过考虑三件事来解决此问题:

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)

解决此问题后,可以通过运行“otool”来检查应用程序是否为 OS X 10.5 正确构建:

otool -l 二进制文件

正确的二进制文件不应包含任何“LC_DYLD_INFO_ONLY”加载命令(仅限“LC_DYLD_INFO”命令)。

(另请参阅我的博客文章 http://grauonline.de/wordpress/?p=71

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 )

往事风中埋 2024-11-05 03:29:09

-arch i386 -Wl,-macosx_version_min,10.5 会有帮助;不过,我不确定它们是否足够。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文