drawpile / Drawpile

A collaborative drawing program
http://drawpile.net/
GNU General Public License v3.0
1.04k stars 132 forks source link

Compile error from beta 4+: relocation R_X86_64_PC32 cannot be used against symbol 'ranf_arr_dummy'; recompile with -fPIC #1143

Closed AngryPenguinPL closed 1 year ago

AngryPenguinPL commented 1 year ago

Hi. When trying to compile Drawpile 2.2.0 beta I see this build error:

make[2]: Leaving directory '/builddir/build/BUILD/Drawpile-2.2.0-beta.7/build'
DEBUG util.py:442:  ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol 'ranf_arr_dummy'; recompile with -fPIC
DEBUG util.py:442:  >>> defined in ../bundled/CMakeFiles/mypaint.dir/libmypaint/rng-double.c.o
DEBUG util.py:442:  >>> referenced by rng-double.c:76 (/builddir/build/BUILD/Drawpile-2.2.0-beta.7/src/drawdance/bundled/libmypaint/rng-double.c:76)
DEBUG util.py:442:  >>>               ../bundled/CMakeFiles/mypaint.dir/libmypaint/rng-double.c.o:(rng_double_new)
DEBUG util.py:442:  ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol 'ranf_arr_started'; recompile with -fPIC
DEBUG util.py:442:  >>> defined in ../bundled/CMakeFiles/mypaint.dir/libmypaint/rng-double.c.o
DEBUG util.py:442:  >>> referenced by rng-double.c:119 (/builddir/build/BUILD/Drawpile-2.2.0-beta.7/src/drawdance/bundled/libmypaint/rng-double.c:119)
DEBUG util.py:442:  >>>               ../bundled/CMakeFiles/mypaint.dir/libmypaint/rng-double.c.o:(rng_double_set_seed)
DEBUG util.py:442:  clang-16: error: linker command failed with exit code 1 (use -v to see invocation)
DEBUG util.py:442:  make[2]: *** [src/drawdance/libengine/CMakeFiles/dpengine.dir/build.make:841: src/drawdance/libengine/libdpengine.so] Error 1
DEBUG util.py:442:  make[1]: *** [CMakeFiles/Makefile2:877: src/drawdance/libengine/CMakeFiles/dpengine.dir/all] Error 2
DEBUG util.py:442:  make[1]: *** Waiting for unfinished jobs....
DEBUG util.py:444:  make[2]: Entering directory '/builddir/build/BUILD/Drawpile-2.2.0-beta.7/build'
DEBUG util.py:444:  [ 43%] Linking CXX shared library libdpshared.so

Full build log: https://file-store.openmandriva.org/api/v1/file_stores/454a142c4b0261541d8b10f04b5c384c37711820.log?show=true

Last good build was on drawpile 2.2.0 beta3. From beta 4 to 7 the error started popping up.

Details: OS: OpenMandriva Cooker Compiler: LLVM/Clang 16.0.6 Linker: LLD cmake 3.27.3 rust 1.71.1

askmeaboutlo0m commented 1 year ago

It tells you how to fix the error: recompile with -fPIC. So try passing -DCMAKE_POSITION_INDEPENDENT_CODE=ON to cmake.

askmeaboutlo0m commented 1 year ago

Looking at the build log, -DBUILD_SHARED_LIBS:BOOL=ON is being passed, which looks like it's cargo-culted from somewhere because Drawpile doesn't and has never built shared libraries. It only uses static and object libraries, the latter of which get broken if you pass this flag. Remove the flag and it should work.

AngryPenguinPL commented 1 year ago

Thanks