[llvm-dev] Linker error with XRay & GCC/libstdc++ 6.1

Dean Michael Berris via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 21 09:39:51 PST 2017


> On 16 Feb 2017, at 13:41, David Blaikie via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> Hi Dean,
> 
> Wondering if you've seen anything like this:
> 
> /usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/projects/compiler-rt/lib/xray/tests/unit && /usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/./bin/clang fdr_logging_test.cc.x86_64.o xray_unit_test_main.cc.x86_64.o gtest-all.cc.x86_64.o -o /usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/projects/compiler-rt/lib/xray/tests/unit/XRayFDRLoggingTest-x86_64 -Wl,-allow-shlib-undefined -m64 -lstdc++ -lm -lpthread -lpthread -L/usr/local/google/home/blaikie/dev/llvm/build/clang/debug/split/notypes/nostandalone/./lib/clang/5.0.0/lib/linux -lclang_rt.xray-x86_64 -latomic -ldl -lrt
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:197: error: undefined reference to 'std::_V2::generic_category()'
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:197: error: undefined reference to 'std::_V2::generic_category()'
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:141: error: undefined reference to 'std::_V2::system_category()'
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:141: error: undefined reference to 'std::_V2::system_category()'
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:197: error: undefined reference to 'std::_V2::generic_category()'
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:141: error: undefined reference to 'std::_V2::system_category()'
> /usr/local/google/home/blaikie/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/system_error:197: error: undefined reference to 'std::_V2::generic_category()'

Interesting -- no, I haven't seen this before. :/

We're using std::error_code and std::make_error_code(...), which should be defined by the standard library. I'm not sure what's special or what's changed with libstdc++ 6.1.

I suspect XRay built with libc++ would require different symbols, (I don't know where std::_V2::... would be defined, whether that's an inline namespace in libc++ or in libstdc++) and therefore won't link properly with libstdc++. At least that's my initial theory here based on the error.

Probably a configuration issue on the compiler-rt side, to make it use libstdc++ instead of libc++ when building the runtimes?

-- Dean



More information about the llvm-dev mailing list