buck-yeh/bux

Clang link error

buck-yeh opened this issue · 1 comments

When I configure the repo to build with Clang like this:

rm CMakeCaches.txt
CXX=clang CC=clang cmake .
make clean
make -j

I got:

/usr/bin/ld: ../src/libbux.a(StrUtil.cpp.o): undefined reference to symbol '_ZSt20__throw_length_errorPKc@@GLIBCXX_3.4'
/usr/bin/ld: /usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [_deps/fetchedbux-build/test/CMakeFiles/test_expand_env.dir/build.make:104: _deps/fetchedbux-build/test/test_expand_env] Error 1
make[1]: *** [CMakeFiles/Makefile2:208: _deps/fetchedbux-build/test/CMakeFiles/test_expand_env.dir/all] Error 2
make: *** [Makefile:103: all] Error 2

Please advice

I found the solution myself by adding

target_link_libraries(... stdc++)