Linking CXX executable worldserver at 99% compiling after cmake already pre-compiled fails.
[ 99%] Linking CXX executable worldserver
/usr/bin/ld: ../../../deps/jemalloc/libjemalloc.a(jemalloc.c.o): relocation R_X86_64_32S against symbol `sz_size2index_tab' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: ../../../deps/jemalloc/libjemalloc.a(large.c.o): relocation R_X86_64_32S against symbol `sz_size2index_tab' can not be used when making a PIE object; recompile with -fPIC
etc.
The error is: https://pastebin.com/pVEkzzNs
I'm running the latest Ubuntu and trying to install the latest AzerothCore per SSH (no auto-installer).
Expected: Everything should work well. Actual: The binaries don't even get created.
The error message relocation R_X86_64_32S ... can not be used when making a PIE object; recompile with -fPIC
indicates that most likely, the project includes precompiled libraries for libjemalloc.a
which are not compiled as PIC code. Since Ubuntu has recently switched to compiling Position Independent Executables by default, with the default toolchain settings all objects which go into an executable must be compiled in PIC mode.
I would probably get in touch with the maintainer(s) of the project you are trying to build, and notify them of this compatibility issue. In the meantime, you might be able to work around this issue by setting CMAKE_EXE_LINKER_FLAGS
to -no-pie
(e.g. edit the variable in ccmake
or cmake-gui
- you will probably have to enable display of "advanced variables" - or specify it on a cmake command line using something like cmake /path/to/source -DCMAKE_EXE_LINKER_FLAGS=-no-pie
). Note that this does decrease security of the resulting executable somewhat, as then the kernel will not be able to apply address space randomization to the base executable.