Enabling Link-Time Optimization and Single-Object Prelink causes Linker error

Originator:m.hanauska
Number:rdar://11280881 Date Originated:19-Apr-2012
Status:Resolved Resolved:Fixed
Product:Developer Tools Product Version:4.2.3
Classification:Serious Bug Reproducible:Always
 
Summary:

Steps to Reproduce:
1. Create a new project of type "Cocoa Application"
2. Go to the target build settings.
3. Enable Link-Time Optimization.
4. Enable Single-Object Prelink.
5. Select "Build" from the "Product" menu.

Expected Results:
The application skeleton should build just fine.

Actual Results:
The build fails, with the error:
"could not process llvm bitcode object file, because /Applications/Xcode.app/Contents/Developer/usr/bin/../lib/libLTO.dylib could not be loaded for architecture x86_64"

Regression:
n/a

Notes:
The library libLTO.dylib is actually there for all platforms, but its not in the directory where LD is searching for it; it's part of the SDKs:

# find /Applications/Xcode.app -name libLTO.dylib

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libLTO.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/libLTO.dylib
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib

Comments

Xcode 4.4 Preview 6 as well as Xcode 4.5 Preview (1) both resolve this issue.

By m.hanauska at June 25, 2012, 11:26 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!