我尝试用这个命令在Mac OS X Lion上编译LLVM2.4。
./configure --enable-pic --prefix=/usr/local CC="gcc -arch i386" CXX="g++ -arch i386"
我得到了这个错误。
Undefined symbols for architecture i386:
"llvm::PATypeHolder::get() const", referenced from:
llvm::ELFWriter::EmitGlobal(llvm::GlobalVariable*) in libLLVMCodeGen.a(ELFWriter.o)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status这有什么问题吗?
发布于 2012-01-05 16:57:05
对于交叉编译,当您使用机器元组提供主机、目标和构建时,configure喜欢它。
如果您不熟悉您的机器元组是什么,您可以使用
gcc -dumpmachine它使用Lion reports:
i686-apple-darwin11请注意,在Lion x86_64-apple-darwin11上,64位有效。但是,为了在构建llvm时使用它:
./configure \
--enable-pic \
--prefix=/usr/local \
--host=i686-apple-darwin11 \
--target=i686-apple-darwin11 \
--build=i686-apple-darwin11这应该可以做到这一点,但是您可能希望包括
--enable-languages=c,c++,obj-c
--enable-optimized 您还可以使用'file‘和'otool’验证您正在链接的库。或者,如果您正在链接的是一个静态归档文件(看起来就是这样)我的快速测试是
ar p somelib.a $(ar t somelib.a | grep \.o | tail -1) | file -你不会遇到i386 OSX Lion box,所以为i386构建clang似乎没有必要-你可以构建64位版本(无论它默认选择什么),然后当你用它编译时,你可以在你的CFLAGS或CXXFLAGS中指定'-m32‘或'-m64’来生成正确的对象位深度。
-n
https://stackoverflow.com/questions/8738143
复制相似问题