确定为二进制文件编译的最低OSX版本 [英] Determine minimum OSX version a binary was compiled for
问题描述
当使用Clang或GCC的Darwin后端为OSX创建可执行文件时,标志-mmacosx-version-min=version
可用于设置可执行文件将运行的最早的OSX版本.
When using Clang's or GCC's Darwin backends to create executables for OSX, the flag -mmacosx-version-min=version
can be used to set the earliest version of OSX the executable will run on.
是否有任何方法可以从给定的可执行文件中追溯使用哪个标志来对其进行编译? IE.有没有办法确定给定可执行文件的目标最低OSX版本?
Is there any way to trace back from a given executable which flag was used to compile it? I.e. is there a way to determine which minimum OSX version is targeted by a given executable?
推荐答案
使用otool -l /path/to/binary
并检查LC_VERSION_MIN_MACOSX
加载命令;具体是版本字段.
Use otool -l /path/to/binary
and inspect the LC_VERSION_MIN_MACOSX
load command; specifically, the version field.
例如,用10.8 SDK编译且目标部署为(-mmacosx-version-min
)10.8的二进制文件应具有如下所示的LC_VERSION_MIN_MACOSX
:
For example, a binary compiled with the 10.8 SDK with deployment target (-mmacosx-version-min
) 10.8 should have an LC_VERSION_MIN_MACOSX
like this:
Load command 9
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.8
sdk 10.8
而使用10.8 SDK(部署目标为10.7)编译的二进制文件应具有如下所示的LC_VERSION_MIN_MACOSX
load命令:
whereas a binary compiled with the 10.8 SDK with deployment target 10.7 should have an LC_VERSION_MIN_MACOSX
load command like this:
Load command 9
cmd LC_VERSION_MIN_MACOSX
cmdsize 16
version 10.7
sdk 10.8
这篇关于确定为二进制文件编译的最低OSX版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!