简体   繁体   English

如何确定在Mac OS Lion上为目标文件/模块编译的目标文件(例如“ x86_64-apple-darwin11.0”)?

[英]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.

相关问题 如何从另一个类访问对象(例如ArrayList)? - How can I access an object (e.g. ArrayList) from another class? 将进程(例如TextEdit)作为可可中的对象 - get process(e.g. TextEdit) as an object in cocoa 混淆,因为我无法弄清楚是什么改变了 python 中 class 的 object 的属性 - confusion because i can't figure out what is changing the attribute of the object of a class in python 如果知道对象的属性等同于该对象,该如何确定它的名称? - How can you figure out the name of an object if you know what it's property is equal to? 你能获得一个开放图形对象实例的Facebook Insights,例如“在风中吹”与歌曲吗? - Can you get Facebook Insights for an open graph object INSTANCE, e.g., “Blowing in the Wind” vs. Songs? 我们可以修改或自定义Java对象的数据结构(例如树,链表等)吗? - Can we modify or customise the data structure(for e.g. tree, Linked List etc.) of Java object(s)? 如何找出Java中对象的标识符? - How do I figure out the identifier of an object in java? 如何确定应用程序中的特定对象已不再使用? - How do I figure out that a particular object in an application is no longer in use? Scala对象组合-访问不同类型的嵌套对象字段(例如Array vs Option [Int]) - scala object composition - accessing nested object fields of different types (e.g. Array vs Option[Int]) 将JSON数组转换为Object(例如[{“Name”:“A”},{“Name”:“B”}]到{“Table1”:[{“Name”:“A”},{“Name”: “B”}]} - convert JSON array to Object (e.g. [{“Name”:“A”},{“Name”:“B”}] to {“Table1”:[{“Name”:“A”},{“Name”:“B”}]}
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM