standardese/cppast

link issue on linux Mint 18.04

Firefly35 opened this issue · 2 comments

I compiled cppast on linux with cmake -DCMAKE_BUILD_TYPE=Debug -DLLVM_CONFIG_BINARY=/opt/llvm/bin/llvm-config ../../cppast/ && make

I then built an application that links with cppast, and I get the following error at link time : -1: error: /libs/build-cppast-Debug/arc/libcppast.a(code_generator.cpp.o): unable to initialize decompress status for section .debug_info

Then I tried to build cppast with clang using cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=clang++ -DLLVM_CONFIG_BINARY=/opt/llvm/bin/llvm-config ../../cppast/ && make
I then built an application that links with cppast, and I get the following error at link time : -1: error: /libs/build-cppast-Debug/src/libcppast.a(cpp_entity_index.cpp.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC

I tried to build my library with -DCMAKE_CXX_COMPILER=clang++ and modifying :

  • cppast/src/CMakelists.txt with set(CMAKE_CXX_FLAGS "-fPIC")
  • cppast/external/tiny-process-library/CMakelists.txt with set(CMAKE_CXX_FLAGS "-fPIC")
    but I still get : -1: error: /libs/build-cppast-Debug/lib_cppast_tiny_process.a(process.cpp.o): relocation R_X86_64_32 against symbol `__gxx_personality_v0@@CXXABI_1.3' can not be used when making a PIE object; recompile with -fPIC

Any help would be appreciated, as I don't get how to have my build successfull on linux. I had no problem building the same application with cppast and llvm from brew on MacOS Mojave.

I'm not sure about those particular issues, try compiling with clang but setting -DCMAKE_POSITION_INDEPENDENT_CODE=ON" instead of manuallying modifying the compiler flags.