[llvm-dev] Undefined symbols in llvm-objdump linkage on x86_64-apple-darwin15

Jack Howarth via llvm-dev llvm-dev at lists.llvm.org
Tue May 24 11:37:16 PDT 2016


On Tue, May 24, 2016 at 2:28 PM, Chris Bieneman <beanz at apple.com> wrote:
> Jack,
>
> What version of CMake are you using?
>
> -Chris

Chris,
      I am using cmake 3.5.2. My read of this problem is as follows.
While libLLVM.dylib is being linked against -lxar when
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON is passed to cmake, the libLLVM.dylib
is created with -Wl,-dead_strip such that any symbols from libxar not
explicitly used with in the object files of libLLVM.dylib are stripped
out. This means that those additional symbols used by llvm-objdump
aren't accessible from libLLVM.dylib's linkage on libxar and an
additional explicit linkage on libxar is required in the
tools/llvm-objdump/CMakeLists.txt when HAVE_LIBXAR and
LLVM_LINK_LLVM_DYLIB are set.
        Jack
>
>> On May 24, 2016, at 11:00 AM, Jack Howarth <howarth.mailing.lists at gmail.com> wrote:
>>
>> On Tue, May 24, 2016 at 1:35 PM, Kevin Enderby <enderby at apple.com> wrote:
>>> Hi Jack,
>>>
>>> Just a guess here, this may be the bug Chris helped me out with in the use of the include file xar/xar.h which is not C++ safe.  I needed to wrap my include via:
>>>
>>> #ifdef HAVE_LIBXAR
>>> extern "C" {
>>> #include <xar/xar.h>
>>> }
>>> #endif
>>>
>>> I think we may need some help from Chris to track this down.  I’ll bug him in a bit to see if he can help us on this.
>>
>> While the build here with  -DLLVM_LINK_LLVM_DYLIB:BOOL=ON passed on
>> the cmake options produces HAVE_LIBXAR:INTERNAL=1 in CMakeCache.txt, I
>> don't see anything in the cmakefiles for tools/llvm-objdump to provide
>> the necessary linkage on the system libxar shared library. Appending
>> the missing linkage for -lxar onto
>> build/stage1tools/llvm-objdump/CMakeFiles/llvm-objdump.dir/link.txt...
>>
>> /sw/src/fink.build/llvm39-3.9.0-1/opt-bin/ccclang++   -fno-common
>> -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 -Werror=date-time -std=c++11 -O3
>> -Wl,-search_paths_first -Wl,-headerpad_max_install_names  -L/sw/lib
>> -Wl,-dead_strip CMakeFiles/llvm-objdump.dir/llvm-objdump.cpp.o
>> CMakeFiles/llvm-objdump.dir/COFFDump.cpp.o
>> CMakeFiles/llvm-objdump.dir/ELFDump.cpp.o
>> CMakeFiles/llvm-objdump.dir/MachODump.cpp.o  -o ../../bin/llvm-objdump
>> ../../lib/libLLVM.dylib -Wl,-rpath, at executable_path/../lib -lxar
>>
>> eliminates the bootstrap failure.
>>
>>>
>>> Kev
>>>
>>>> On May 24, 2016, at 10:28 AM, Jack Howarth <howarth.mailing.lists at gmail.com> wrote:
>>>>
>>>> On Tue, May 24, 2016 at 1:24 PM, Jack Howarth
>>>> <howarth.mailing.lists at gmail.com> wrote:
>>>>> On Tue, May 24, 2016 at 1:22 PM, Jack Howarth
>>>>> <howarth.mailing.lists at gmail.com> wrote:
>>>>>> On Tue, May 24, 2016 at 12:08 PM, Reid Kleckner <rnk at google.com> wrote:
>>>>>>> Kevin Enderby added those symbol uses in r270491. It has a cmake
>>>>>>> feature test, and all the uses of those symbols appear bracketed in
>>>>>>> HAVE_LIBXAR, so I don't know what went wrong for you.
>>>>>>
>>>>>> The trigger for this build failure is the usage of
>>>>>> -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON. If I drop that cmake
>>>>>> option, the linkage failure for llvm-objdump disappears.
>>>>>
>>>>> Wrong cmake option. I meant to say that -DLLVM_LINK_LLVM_DYLIB:BOOL=ON
>>>>> is the trigger of the build failure. Sorry for the noise there.
>>>>
>>>> Filed as https://llvm.org/bugs/show_bug.cgi?id=27855
>>>>
>>>>>
>>>>>>
>>>>>>>
>>>>>>> On Tue, May 24, 2016 at 8:07 AM, Jack Howarth via llvm-dev
>>>>>>> <llvm-dev at lists.llvm.org> wrote:
>>>>>>>> Is anyone else seeing a bootstrap failure on x86_64-apple-darwin15 in
>>>>>>>> current trunk?
>>>>>>>>
>>>>>>>> [ 95%] Linking CXX executable ../../bin/llvm-objdump
>>>>>>>> Undefined symbols for architecture x86_64:
>>>>>>>> "_xar_serialize", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_file_first", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_iter_new", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_prop_first", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_extract_tobuffersz", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_open", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_prop_get", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_close", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_prop_next", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_iter_free", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> "_xar_file_next", referenced from:
>>>>>>>>     DumpBitcodeSection(llvm::object::MachOObjectFile*, char const*,
>>>>>>>> unsigned int, bool, bool, bool, std::__1::basic_string<char,
>>>>>>>> std::__1::char_traits<char>, std::__1::allocator<char> >) in
>>>>>>>> MachODump.cpp.o
>>>>>>>> ld: symbol(s) not found for architecture x86_64
>>>>>>>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>>>>>>> tools/llvm-objdump/CMakeFiles/llvm-objdump.dir/build.make:173: recipe
>>>>>>>> for target 'bin/llvm-objdump' failed
>>>>>>>> make[2]: *** [bin/llvm-objdump] Error 1
>>>>>>>> make[2]: Target 'tools/llvm-objdump/CMakeFiles/llvm-objdump.dir/build'
>>>>>>>> not remade because of errors.
>>>>>>>> CMakeFiles/Makefile2:21861: recipe for target
>>>>>>>> 'tools/llvm-objdump/CMakeFiles/llvm-objdump.dir/all' failed
>>>>>>>> make[1]: *** [tools/llvm-objdump/CMakeFiles/llvm-objdump.dir/all] Error 2
>>>>>>>> _______________________________________________
>>>>>>>> LLVM Developers mailing list
>>>>>>>> llvm-dev at lists.llvm.org
>>>>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>>
>


More information about the llvm-dev mailing list