Opened 12 years ago

Closed 12 years ago

Last modified 9 years ago

#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: larryv (Lawrence Velázquez), neverpanic (Clemens Lang), skymoo (Adam Mercer), drkp (Dan Ports), cooljeanius (Eric Gallager)
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 (3)

main.log (100.1 KB) - added by obartunov@… 12 years ago.
main.log
ld64-main.log (105.2 KB) - added by larryv (Lawrence Velázquez) 12 years ago.
ld64 main log
no-liblto-in-developer-dir.patch (534 bytes) - added by neverpanic (Clemens Lang) 12 years ago.
patch against the Portfile, linking against /usr/lib/libLTO.dylib instead

Download all attachments as: .zip

Change History (20)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: obartunov@… removed
Owner: changed from macports-tickets@… to mfeiri@…
Port: ld64 added

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

Changed 12 years ago by obartunov@…

Attachment: main.log added

main.log

comment:2 Changed 12 years ago by obartunov@…

I cleaned, but it's still failed. I attached main.log

comment:3 Changed 12 years ago by larryv (Lawrence Velázquez)

Cc: larry.velazquez@… added

Cc Me!

comment:4 Changed 12 years ago by larryv (Lawrence Velázquez)

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.

Changed 12 years ago by larryv (Lawrence Velázquez)

Attachment: ld64-main.log added

ld64 main log

comment:5 Changed 12 years ago by jwhowse4

I have the same problem with Lion 10.7.3, Xcode 4.3 and MacPort 2.0.4.

comment:6 Changed 12 years ago by mfeiri

Status: newassigned

Please try again now. I've committed an update to version 128.2 a couple of hours ago in r90363.

Changed 12 years ago by neverpanic (Clemens Lang)

patch against the Portfile, linking against /usr/lib/libLTO.dylib instead

comment:7 Changed 12 years ago by neverpanic (Clemens Lang)

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 Changed 12 years ago by neverpanic (Clemens Lang)

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 12 years 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 12 years 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 12 years ago by neverpanic (Clemens Lang)

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 12 years 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:13 Changed 12 years ago by skymoo (Adam Mercer)

Cc: ram@… added

Cc Me!

comment:14 Changed 12 years ago by drkp (Dan Ports)

Cc: dports@… added

Cc Me!

comment:15 Changed 12 years ago by mfeiri

Resolution: fixed
Status: assignedclosed

Fixed in r90446. Decided to use the unix way.

comment:16 Changed 12 years ago by obartunov@…

Thanks, that works !

comment:17 Changed 9 years ago by cooljeanius (Eric Gallager)

Cc: egall@… added

Cc Me!

Note: See TracTickets for help on using tickets.