Closed monkey-w1n5t0n closed 2 years ago
Building from source on Manjaro fails with a linker error, build output:
$ clang --version clang version 13.0.0 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin $ cmake -S . -B build - LLVM version: 13.0.0 -- LLVM version major: 13 -- LLVM version minor: 0 -- System name: Linux -- System processor: x86_64 -- System version: 5.10.89-1-MANJARO -- Build type: RELEASE -- Configuring done -- Generating done -- Build files have been written to: /home/w1n5t0n/dev/lang/dale/build $ cmake --build build Consolidate compiler generated dependencies of target dale [ 0%] Building CXX object CMakeFiles/dale.dir/src/dale/Arch/Arch.cpp.o [ 1%] Building CXX object CMakeFiles/dale.dir/src/dale/Introspection/Introspection.cpp.o [ 2%] Building CXX object CMakeFiles/dale.dir/src/dale/Operation/Cast/Cast.cpp.o ... ... [ 86%] Built target math [ 87%] Built target vector [ 87%] Built target algorithms [ 87%] Built target derivations [ 88%] Generating module-to-markdown /usr/bin/ld: /tmp/module-to-markdown-f3dd12.o: relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIE clang-13: error: linker command failed with exit code 1 (use -v to see invocation) ./dalec: /usr/bin/clang failed make[2]: *** [CMakeFiles/programs.dir/build.make:73: module-to-markdown] Error 1 make[1]: *** [CMakeFiles/Makefile2:336: CMakeFiles/programs.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
Tried adding -fPIE to CMAKE_CXX_FLAGS (not sure if that's where it belongs) as per the message's suggestion, didn't work.
-fPIE
Thanks for this. Setting the relocation model to PIC when constructing the target machine appears to have fixed the problem (tested using the manjarolinux/base Docker container).
That solved it, thanks!
Building from source on Manjaro fails with a linker error, build output:
Tried adding
-fPIE
to CMAKE_CXX_FLAGS (not sure if that's where it belongs) as per the message's suggestion, didn't work.