[英]How can I figure out what “target” an object file/module is compiled for on Mac OS Lion (e.g. “x86_64-apple-darwin11.0”)?
I'm trying to compile some code for OS X Lion and I'm running into problems with linking the object files and libraries. 我正在尝试为OS X Lion编译一些代码,并且在链接目标文件和库时遇到问题。 I get this error: 我收到此错误:
WARNING: Linking two modules of different target triples: 'x86_64-apple-darwin11.0' and 'x86_64-apple-darwin10' 警告:链接具有不同目标三元组的两个模块:'x86_64-apple-darwin11.0'和'x86_64-apple-darwin10'
Is there a command line tool/command that I can run to see what the target of the object files or libraries is? 是否可以运行命令行工具/命令以查看目标文件或库的目标是什么? Then I can go back and debug the compiling to process to make sure everyone is targeting the same build. 然后,我可以返回并调试编译过程,以确保每个人都针对同一构建。
Thanks! 谢谢! -Don -唐
For llvm bitcode modules you can disassemble them using llvm-dis and look at the module there: 对于llvm位码模块,可以使用llvm-dis对其进行反汇编,然后查看其中的模块:
[yendi:~] echristo% llvm-dis foo.bc -o - | grep "target triple"
target triple = "x86_64-apple-macosx10.7.0"
Not complete information, but in general to get the architecture you'll want to use 'file': 尚不完整的信息,但是通常要获得使用“文件”的体系结构:
For an individual .o file: 对于单个.o文件:
[yendi:~] echristo% file foo.o
foo.o: Mach-O 64-bit object x86_64
or if you're creating a bitcode file with -O4: 或使用-O4创建位码文件:
[yendi:~] echristo% /Volumes/Data/builds/build-llvm/Debug+Asserts/bin/clang++ foo.cc -c -emit-llvm -o foo.bc -O4
[yendi:~] echristo% file foo.bc
foo.bc: LLVM bit-code object x86_64
which won't get you the full triple, but will get you file information. 这不会让您获得完整的三元组,但会为您提供文件信息。
My guess is that you have some old object files sitting around or are pass -mmacosx-version-min=10.6 on some files and not on others. 我的猜测是您周围有一些旧的目标文件,或者在某些文件上传递-mmacosx-version-min = 10.6而不在其他文件上传递。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.