You are not logged in.

#1 2015-08-02 20:52:27

SkepticalMystic
Member
Registered: 2013-04-25
Posts: 7

[SOLVED] Error compiling program with Clang/Libc++

I'm trying to install a Market Tool for EVE Online called Evernus. ( www.evernus.com )
The tool is cross platform, but created using clang which I don't have much experience with. I also know next to nothing about compiler flags or linking. Any assistance would be appreciated.

Here's the setup:
Arch Linux x86_64
Kernel 4.1.2-2-ARCH
cmake = 3.2.3
clang = 3.6.2
libc++3.6.2-1
QT = 5.5.0
boost = 1.58.0-2

Cloned from bitbucket using:
hg clone https://bitbucket.org/krojew/evernus

cmake as directed in the guide:
CC=clang CXX=clang++ cmake -G "Unix Makefiles"

make completes building to 100% then fails with

Linking CXX executable evernus
/usr/bin/ld: CMakeFiles/evernus.dir/TypeAggregatedDetailsWidget.cpp.o: undefined reference to symbol '_ZNSt12length_errorD2Ev@@GLIBCXX_3.4.15'
/usr/lib/libstdc++.so.6: error adding symbols: DSO Missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/evernus.dir/build.make:9745: recipe for target 'evernus' failed
make[2]: *** [evernus] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/evernus.dir/all' failed
make[1]: *** [CMakeFiles/evernus.dir/all] Error 2
Makefile:116: recipe for target 'all' failed
make: *** [all] Error 2

I've also tried with the following cmake flags,
-D_CMAKE_TOOLCHAIN_PREFIX=llvm-
-DCMAKE_CXX_FLAGS="-stdlib=libc++"
-DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++"

All have the same error. It seems that it's not using libc++ perhaps, but I can't seem to figure out how to fix that. I've run make with VERBOSE=1 and it shows that the flags are being applied successfully.

I read that it could be that Boost wasn't built with Clang, so it could have hard links to libstdc++ so I uninstalled Boost and reinstalled it manually with --with-toolchain=clang. Building boost this way worked fine, but the same problem occurred. I tried building boost again with the added cxxflags and linkflags -stdlib=libc++ and Boost fails to build with those flags.

I'm at a loss now. Any suggestions that anyone can give me would be appreciated.

Last edited by SkepticalMystic (2015-08-03 21:00:22)

Offline

#2 2015-08-03 04:46:38

ayekat
Member
Registered: 2011-01-17
Posts: 1,589

Re: [SOLVED] Error compiling program with Clang/Libc++

Have you tried building evernus from the old AUR? Or at least have a look at its PKGBUILD to see which flags it passes to the linker that are different from what you do?

For instance,

-lm -lstdc++ -lc++ -lc++abi

are missing in your example - it's possible that `length_error`, which is defined in a C++ library, is not linked in (although it's a little weird, as to my knowledge a C++ compiler should automatically link in C++ libraries...) [EDIT I'm sorry, I didn't read your post to the end]

Also, could you please use [ code ] tags for posting code snippets? It's easier to read and is less confusing.

Last edited by ayekat (2015-08-03 04:49:12)


pkgshackscfgblag

Offline

#3 2015-08-03 18:18:16

SkepticalMystic
Member
Registered: 2013-04-25
Posts: 7

Re: [SOLVED] Error compiling program with Clang/Libc++

Thanks for the reply. I've been fighting with this for a week, and somehow I never found that copy on the AUR. Apparently that's all I needed. Built from that PKGBUILD no problem. Thanks a lot for the help.

Offline

Board footer

Powered by FluxBB