[llvm-dev] Ubuntu trusty static linking error: undefined reference to `std::system_category()' with apt.llvm.org

Andreas Fertig via llvm-dev llvm-dev at lists.llvm.org
Thu May 31 10:37:25 PDT 2018


Hello,

I try to compile a clang-tool (C++ Insights) statically under Ubuntu 
trusty. Unfortunately, I end up with a lot of linker errors:
/usr/lib/llvm-6.0/lib/libLLVMSupport.a(Program.cpp.o): In function 
`llvm::sys::ChangeStdoutToBinary()':
(.text._ZN4llvm3sys20ChangeStdoutToBinaryEv+0x5): undefined reference to 
`std::system_category()'

The same build system works with debian testing. I use the kindly 
provided LLVM apt repository to get LLVM and clang 6.0. Under Ubuntu 
trusty libLLVMSupport wants std::system_category, while libstdc++ 
provides std::_V2::system_category:

nm -C /usr/lib/llvm-6.0/lib/libLLVMSupport.a | grep system_cat
                  U std::system_category()
                  ...
                  U std::system_category()

nm -C /usr/lib/gcc/x86_64-linux-gnu/8/libstdc++.a | grep system_cat
nm: compatibility-debug_list-2.o: no symbols
0000000000000000 d (anonymous namespace)::system_category_instance
0000000000000000 T std::_V2::system_category()

A look on the dependencies shows that llvm requires libstdc++6 but 
libclang libstdc++-4.9-dev:

apt-cache depends llvm-6.0-dev
llvm-6.0-dev
   Depends: libc6
   Depends: libjsoncpp0
   Depends: libllvm6.0
   Depends: libstdc++6
   Depends: libffi-dev
   Depends: llvm-6.0
   Depends: libtinfo-dev
   Replaces: <llvm>

apt-cache depends libclang-6.0-dev
libclang-6.0-dev
   Depends: libstdc++-4.9-dev
   Depends: libgcc-4.9-dev
   Depends: libobjc-4.9-dev
   Depends: libclang1-6.0
   Depends: libclang-common-6.0-dev


Debian testing on the other hands gives this output:

apt-cache depends llvm-7-dev
llvm-7-dev
   Depends: libc6
   Depends: libgcc1
   Depends: libjsoncpp1
   Depends: libllvm7
   Depends: libstdc++6
   Depends: libffi-dev
   Depends: llvm-7
   Depends: libtinfo-dev
     libncurses-dev
   Replaces: <llvm>

apt-cache depends libclang-7-dev
libclang-7-dev
   Depends: libstdc++-6-dev
   Depends: libgcc-6-dev
   Depends: libobjc-6-dev
   Depends: libclang1-7
   Depends: libclang-common-7-dev

Here the two seem to match.

Any advice how to get this sorted out? Looks like an ABI mismatch to me.


Best regards,

     Andreas




More information about the llvm-dev mailing list