在64位OS X 10.6上制作胖二进制文件的正确方法更适合32位?

时间:2023-01-25 02:43:04

Suppose I ask the user "do you want to run in 32bit mode or 64bit mode" and they pick 32bit. How do I register this fact with the operating system? I've looked at the arch command, but I don't want to have to write a script that wraps the binary. I suspect there is a plist-y way to do this, but I can't find documentation (other than arch).

假设我问用户“你想要在32位模式还是64位模式下运行”,他们选择32位。如何在操作系统中注册此事实?我查看了arch命令,但我不想写一个包装二进制文件的脚本。我怀疑有一种方法可以做到这一点,但我找不到文档(除了arch)。

3 个解决方案

#1


5  

Try using this Info.plist key, LSArchitecturePriority:

尝试使用此Info.plist密钥,LSArchitecturePriority:

<key>LSArchitecturePriority</key>
<array>
    <string>i386</string>
    <string>x86_64</string>
    <string>ppc</string>
    <string>ppc64</string>
</array>

Just don't do this by dynamically altering your program's bundle. The user running your program might not have permission to write to it. If you need to do this on a per-user basis, a wrapper script would be a preferred alternative.

只是不要通过动态改变你的程序包来做到这一点。运行程序的用户可能没有写入该程序的权限。如果您需要基于每个用户执行此操作,则包装器脚本将是首选替代方案。

#2


1  

You're probably looking for something like LSArchitecturePriority. Runtime Configuration Guidelines - Property List Key Reference is the documentation for all the key / values for an .app bundles Info.plist file.

你可能正在寻找像LSArchitecturePriority这样的东西。运行时配置指南 - 属性列表键参考是.app包Info.plist文件的所有键/值的文档。

#3


0  

The other way to do it is by setting the ARCHPREFERENCE environment variable, as described on the arch man page.

另一种方法是设置ARCHPREFERENCE环境变量,如arch手册页中所述。

#1


5  

Try using this Info.plist key, LSArchitecturePriority:

尝试使用此Info.plist密钥,LSArchitecturePriority:

<key>LSArchitecturePriority</key>
<array>
    <string>i386</string>
    <string>x86_64</string>
    <string>ppc</string>
    <string>ppc64</string>
</array>

Just don't do this by dynamically altering your program's bundle. The user running your program might not have permission to write to it. If you need to do this on a per-user basis, a wrapper script would be a preferred alternative.

只是不要通过动态改变你的程序包来做到这一点。运行程序的用户可能没有写入该程序的权限。如果您需要基于每个用户执行此操作,则包装器脚本将是首选替代方案。

#2


1  

You're probably looking for something like LSArchitecturePriority. Runtime Configuration Guidelines - Property List Key Reference is the documentation for all the key / values for an .app bundles Info.plist file.

你可能正在寻找像LSArchitecturePriority这样的东西。运行时配置指南 - 属性列表键参考是.app包Info.plist文件的所有键/值的文档。

#3


0  

The other way to do it is by setting the ARCHPREFERENCE environment variable, as described on the arch man page.

另一种方法是设置ARCHPREFERENCE环境变量,如arch手册页中所述。