[LLVMdev] Transparent LTO on Mac OS X

Shantonu Sen
Fri, 04 Dec 2009 22:27:18 -0000

Are you building llvm-gcc yourself? If so, what version?

Xcode releases include an older llvm-gcc and libLTO.dylib, which may not
understand bitcode generated by newer self-built compilers.

If you are only using llvm-gcc from the Xcode tools release, use the driver
from:
/Developer/usr/bin/llvm-gcc-4.2

If you are building llvm-gcc yourself, try, in this order:
1) sudo ln -s ../../Developer/usr/lib/libLTO.dylib /usr/lib/libLTO.dylib

2) If you still get errors, try installing the libLTO.dylib from your LLVM build
into /Developer/usr/lib. Make sure that if you're on a 64-bit machine, you
built llvm for x86_64-apple-darwin10 (which should be the default)


Shantonu Sen
ssen at apple.com

Sent from my Mac Pro

On Dec 4, 2009, at 1:57 PM, John Criswell wrote:

> John Criswell wrote:
>> Dear All,
>>
>> I'm trying to use transparent link-time optimization on Mac OS X.
>>
>> I've got Xcode 3.2 installed, and I'm trying to compile code
with
>> llvm-gcc -O4.  However, I get the following error:
>>
>> gcc -O4 -o dftables .libs/dftables.o
>> ld: warning: in .libs/dftables.o, file is not of required architecture
>> Undefined symbols:
>>  "_main", referenced from:
>>      start in crt1.10.6.o
>> ld: symbol(s) not found
>> collect2: ld returned 1 exit status
>>
> I should add that the gcc above is a symbolic link to llvm-gcc.
>
> -- John T.
>
>> It seems that the linker doesn't understand the bitcode format.  Am
I
>> missing a command line option?  Do I need a newer version of XCode?
>>
>> -- John T.
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev