简体   繁体   English

使用 MacOS 10.13 中的构建工具正确定位 MacOS 10.6

[英]Correctly target MacOS 10.6 using the build tools from MacOS 10.13

Out of sheer academic curiosity I am trying to make a MacOS GUI application ultra compatible — meaning that it has to run on all versions of MacOS from 10.6 to 10.14;出于纯粹的学术好奇心,我正在尝试让 MacOS GUI 应用程序超级兼容——这意味着它必须在从 10.6 到 10.14 的所有 MacOS 版本上运行; going beyond this range is restricted by the differences in Cocoa API and CoreText/CoreGraphics.超出此范围受到 Cocoa API 和 CoreText/CoreGraphics 的差异的限制。
Unfortunately the app depends significantly on several features of C11, eg __auto_type , so I cannot just go and compile it on 10.6, having to resort to cross-compilation.不幸的是,该应用程序很大程度上依赖于 C11 的几个功能,例如__auto_type ,所以我不能只 go 并在 10.6 上编译它,不得不求助于交叉编译。

The problem is that after being linked on 10.13 the resulting x86-32 Mach-O binary contains 3 load commands in its header that the dyld of 10.6 cannot recognize:问题是,在 10.13 上链接后,生成的 x86-32 Mach-O 二进制文件在其 header 中包含 3 个加载命令,10.6 的dyld无法识别:

  1. LC_MAIN (0x80000028) LC_MAIN (0x80000028)
  2. LC_DATA_IN_CODE (0x00000029) LC_DATA_IN_CODE (0x00000029)
  3. LC_SOURCE_VERSION (0x0000002A) LC_SOURCE_VERSION (0x0000002A)

My question is:我的问题是:
How do I tell the llvm-gcc linker to avoid inserting these commands, and eg substitute LC_MAIN with the more compatible LC_UNIXTHREAD, etc.?我如何告诉llvm-gcc linker 避免插入这些命令,例如用更兼容的 LC_UNIXTHREAD 替换 LC_MAIN 等?

Use -macosx_version_min 10.6 as ld parameter.使用-macosx_version_min 10.6 作为ld参数。 This will generate LC_UNIXTHREAD instead of LC_MAIN in your executable (among other legacy load commands you're after).这将在您的可执行文件中生成LC_UNIXTHREAD而不是LC_MAIN (在您之后的其他旧加载命令中)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM