开发者

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 l开发者_运维百科ibraries. I get this error:

WARNING: Linking two modules of different target triples: 'x86_64-apple-darwin11.0' and '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:

[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:

[yendi:~] echristo% file foo.o
foo.o: Mach-O 64-bit object x86_64

or if you're creating a bitcode file with -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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜