Opened 7 years ago

Last modified 3 years ago

#53150 accepted defect

llvm-3.8: llvm ld: unknown option: -export_dynamic

Reported by: gbrtrac Owned by: jeremyhu (Jeremy Huddleston Sequoia)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: cooljeanius (Eric Gallager)
Port: llvm-3.8

Description (last modified by ryandesign (Ryan Carsten Schmidt))

There is an unknown linker flag being used in the building of llvm

:info:build /opt/local/bin/clang++-mp-3.7   -pipe -Os -std=c++11 -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -std=c++11 -DNDEBUG -arch x86_64 -mmacosx-version-min=10.9 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names  -rdynamic CMakeFiles/bugpoint.dir/BugDriver.cpp.o CMakeFiles/bugpoint.dir/CrashDebugger.cpp.o CMakeFiles/bugpoint.dir/ExecutionDriver.cpp.o CMakeFiles/bugpoint.dir/ExtractFunction.cpp.o CMakeFiles/bugpoint.dir/FindBugs.cpp.o CMakeFiles/bugpoint.dir/Miscompilation.cpp.o CMakeFiles/bugpoint.dir/OptimizerDriver.cpp.o CMakeFiles/bugpoint.dir/ToolRunner.cpp.o CMakeFiles/bugpoint.dir/bugpoint.cpp.o  -o ../../bin/bugpoint -Wl,-rpath,/opt/local/libexec/llvm-3.8/lib  ../../lib/libLLVM.dylib 
:info:build ld: unknown option: -export_dynamic

Attachments (1)

main.log (339.8 KB) - added by gbrtrac 7 years ago.

Download all attachments as: .zip

Change History (16)

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

Description: modified (diff)
Owner: set to jeremyhu
Port: llvm-3.8 added
Status: newassigned
Summary: llvm ld: unknown option: -export_dynamicllvm-3.8: llvm ld: unknown option: -export_dynamic

comment:2 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

What is the output of:

/opt/local/libexec/llvm-3.7/bin/ld -v
Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Status: assignedaccepted

comment:4 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Note that's just a warning from the linker. Are you seeing fallout from it?

comment:5 Changed 7 years ago by gbrtrac

The "warning" actually stops the build -- treated as an error

/opt/local/libexec/llvm-3.7/bin/ld -v
@(#)PROGRAM:ld  PROJECT:ld64-136
configured to support archs: i386 x86_64 armv7 armv7s
LTO support using: LLVM version 3.7.1
Last edited 5 years ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:6 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

What port were you trying to build when you encountered this error?

Please attach the full build log.

Changed 7 years ago by gbrtrac

Attachment: main.log added

comment:7 Changed 7 years ago by gbrtrac

The same thing happens if I clean and run the build

comment:8 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Why did you decide to use the +ld64_variant? ld64-136 is really only useful for Leopard. If you use ld64-latest instead, I expect you can get past this.

clang should be only setting that on newer versions of ld that support it (137+):

commit bd77c59acc58e797756b0fcc6739319587e95d85
Author: Bob Wilson <bob.wilson@apple.com>
Date:   Fri Aug 2 22:25:34 2013 +0000

    Only use the Darwin linker's -export_dynamic option with supported versions.
    
    Related to <rdar://problem/14578094>.
    
    git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187680 91177308-0d34-0410-b5e6-96231b3b80d8
Last edited 7 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:9 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Reduced:

$ clang-mp-devel -c true.c && clang-mp-devel -rdynamic true.o -v
...
 "/opt/local/libexec/llvm-devel/bin/ld" -demangle -export_dynamic -lto_library /opt/local/libexec/llvm-devel/lib/libLTO.dylib -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o a.out true.o -lSystem /opt/local/libexec/llvm-devel/bin/../lib/clang/4.0.0/lib/darwin/libclang_rt.osx.a
ld: unknown option: -export_dynamic
clang: error: linker command failed with exit code 1 (use -v to see invocation)

$ /opt/local/libexec/llvm-devel/bin/ld -v
@(#)PROGRAM:ld  PROJECT:ld64-136
configured to support archs: i386 x86_64 armv7 armv7s
LTO support using: LLVM version 4.0.0svn
Last edited 7 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:10 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

comment:11 Changed 7 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Do the following to fix this on your system:

sudo port -v -f deactivate ld64
sudo port -v install ld64 -ld64_136

This ticket tracks improving messaging to users and/or making this a bit more foolproof.

Last edited 7 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:12 Changed 7 years ago by gbrtrac

That resolved it

comment:13 Changed 4 years ago by kencu (Ken)

Cc: kencu added

comment:14 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:15 Changed 3 years ago by kencu (Ken)

Cc: kencu removed
Note: See TracTickets for help on using tickets.