I am updating a travis file to use the new bionic VMs. The build system is CMake.
While everything seems to work fine with g++, with clang the build fails when compiling a shared library, mentioning the infamouse gxx personality linker error and mentioning -fPic. Additionally CMake can’t enable LTO optimization with clang.
Given that fPic was passed, and that on my local machine everything works fine (I’m comparing the log builds line by line, the only differences seems to be the binaries paths), so I’m wondering whether there are some differences with the linker with the default settings between g++ and clang that could be causing this.
You can see the LTO failure at line 766, while the linker error at line 2385 (of the clang build). The line numbers are similar for the working g++ build.
/usr/bin/ld: /usr/local/clang-7.0.0/bin/../lib/LLVMgold.so: error loading plugin: /usr/local/clang-7.0.0/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory
/usr/bin/ld: ../libAIToolboxFMDP.a(JointActionLearner.cpp.o): relocation R_X86_64_32 against symbol `__gxx_personality_v0@@CXXABI_1.3' can not be used when making a shared object; recompile with -fPIC
Looks like ../libAIToolboxFMDP.a was compiled without -fPIC