Ticket #33439 (closed defect: fixed)
ld64 build failed under lion 10.7
| Reported by: | obartunov@… | Owned by: | mfeiri@… |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.0.4 |
| Keywords: | haspatch | Cc: | larry.velazquez@…, cal@…, ram@…, dports@… |
| Port: | ld64 |
Description
I tried to build ld64 on my MBA running Lion 10.7, Xcode 4.3. I had successfully built several ports, so macports seems works on my computer. Yesterday I tried to install R, but it failed on ld64.
root@dyn-218:~# port -v install ld64
---> Computing dependencies for ld64.
---> Building ld64
Build settings from command line:
ARCHS = x86_64
GCC_VERSION = com.apple.compilers.llvm.clang.1_0
MACOSX_DEPLOYMENT_TARGET = 10.7
OBJROOT = build/
SDKROOT =
SYMROOT = build/
=== BUILD NATIVE TARGET ld OF PROJECT ld64 WITH CONFIGURATION Release ===
Check dependencies
Ld build/Release/ld normal x86_64
cd /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64/work/ld64-127.2
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -L/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64/work/ld64-127.2/build/Release -F/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64/work/ld64-127.2/build/Release -filelist /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64/work/ld64-127.2/build/ld64.build/Release/ld.build/Objects-normal/x86_64/ld.LinkFileList -mmacosx-version-min=10.7 -Wl,-lazy_library,/Applications/Xcode.app/Contents/Developer/usr/lib/libLTO.dylib -Wl,-exported_symbol,__mh_execute_header -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_ld64/ld64/work/ld64-127.2/build/Release/ld
ld: file not found: /Applications/Xcode.app/Contents/Developer/usr/lib/libLTO.dylib
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ failed with exit
Attachments
Change History
comment:1 Changed 15 months ago by ryandesign@…
- Cc obartunov@… removed
- Owner changed from macports-tickets@… to mfeiri@…
- Port set to ld64
comment:2 Changed 15 months ago by obartunov@…
I cleaned, but it's still failed. I attached main.log
comment:4 Changed 15 months ago by larry.velazquez@…
I encounter the same problem. The build process is looking for /Applications/Xcode.app/Contents/Developer/usr/lib/libLTO.dylib, which is nonexistent. But:
% sudo find -x / -name .MobileBackups -prune -or -name libLTO.dylib /.MobileBackups /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/libLTO.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libLTO.dylib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib /opt/local/libexec/llvm-2.9/lib/libLTO.dylib /opt/local/libexec/llvm-3.0/lib/libLTO.dylib /usr/lib/libLTO.dylib
OS X 10.7.3 (11D50b), Xcode 4.3 (4E109), MacPorts 2.0.4.
comment:5 Changed 15 months ago by jwhowse4@…
I have the same problem with Lion 10.7.3, Xcode 4.3 and MacPort 2.0.4.
comment:6 Changed 15 months ago by mfeiri@…
- Status changed from new to assigned
Please try again now. I've committed an update to version 128.2 a couple of hours ago in r90363.
Changed 15 months ago by cal@…
- Attachment no-liblto-in-developer-dir.patch added
patch against the Portfile, linking against /usr/lib/libLTO.dylib instead
comment:7 Changed 15 months ago by cal@…
- Cc cal@… added
- Keywords haspatch added
I can reproduce this on 10.7, Xcode 4.3 and MacPorts 2.0.4, too.
While there seems to be a libLTO.dylib in the 10.7 SDK, it really is just a broken symlink:
$ ls -lash /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libLTO.dylib lrwxr-xr-x 1 root wheel 37 Feb 18 00:12 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/libLTO.dylib -> ../..//Developer/usr/lib/libLTO.dylib $ file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/usr/lib/libLTO.dylib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/usr/lib/libLTO.dylib: cannot open `/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/Developer/usr/lib/libLTO.dylib' (No such file or directory)
I have used /usr/lib/libLTO.dylib in the proposed patch instead and the port builds fine with this patch.
comment:8 follow-up: ↓ 10 Changed 15 months ago by cal@…
Just to clarify: This patch is against the new version 128.2 of ld64, commited in r90363, which still fails for me without the patch.
comment:9 Changed 15 months ago by jwhowse4@…
The library libLTO.dylib also exists in the directory
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/
and this file is identical to the one in /usr/lib.
comment:10 in reply to: ↑ 8 Changed 15 months ago by obartunov@…
Replying to cal@…:
Just to clarify: This patch is against the new version 128.2 of ld64, commited in r90363, which still fails for me without the patch.
Where to get version 128.2 ? I have 127.2. I tried to apply manually your patch, but port still fails with the same problem. I patched /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/devel/ld64/Portfile
comment:11 Changed 15 months ago by cal@…
Running selfupdate should get you the current version; however syncing the ports tree via rsync might be delayed by an hour or something, since the tarball isn't updated immediately.
comment:12 Changed 15 months ago by mfeiri@…
The ld64 port should actually use the libLTO library provided by macports. Only a "lucky" combination of lazy linking and a relative link path covered this bug and an issue in our llvm ports. I'll try to figure out if we should fix this the apple way (by removing an install_name_tool patch in llvm-X.X) or the unix way (by adding an additional install_name_tool patch in ld64). You can see a preview at http://macports.feiri.eu/devel/ld64/Portfile (this currently shows the unix way).
comment:15 Changed 15 months ago by mfeiri@…
- Status changed from assigned to closed
- Resolution set to fixed
Fixed in r90446. Decided to use the unix way.
comment:16 Changed 15 months ago by obartunov@…
Thanks, that works !


Please "sudo port clean ld64" and try again. If it fails again, attach the main.log file.