libratbag: Build error with ninja

It built the first 72 files without errors however it choked at the 73rd. I lost that output, but running ninja -C builddir again shows the same error output. Can’t seem to build. Compiled without any errors, but I can’t seem to get through this one.

ninja: Entering directory `builddir' [1/1] Linking target _libratbag.so FAILED: _libratbag.so cc -o _libratbag.so 'libratbag@sha/libratbag@sha_libratbag.c.o' '-L/usr/local/lib' '-Wl,--no-undefined' '-Wl,--as-needed' '-shared' '-fPIC' '-Wl,-soname,_libratbag.so' 'libutil.a' 'libhidpp.a' 'libratbag.a' 'libutil.a' 'libhidpp.a' 'libutil.a' 'libhidpp.a' 'libutil.a' 'libhidpp.a' 'libshared.a' '-ludev' '-levdev' '-lglib-2.0' '-lpython3.6m' '-ludev' '-levdev' '-lglib-2.0' '-ludev' '-lm' '-ludev' '-levdev' '-lglib-2.0' '-ludev' '-lm' '-ludev' '-lm' '-ludev' '-levdev' '-Wl,-rpath,/home/xevile/src/libratbag/builddir/' /usr/bin/ld: /usr/local/lib/libpython3.6m.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython3.6m.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

The issue is you can not embed the code in a library that uses -fPIC if libpython3.6m.a was not compiled with -fPIC either. At least that’s how I understand the error message.

Any reasons you would not use your distributed provided python development package? Here, if you need to use your own version, the solution is to rebuild the devel package with -fPIC. Looking at other people having the same issue (https://github.com/pytorch/pytorch/issues/997 for instance), you need to set --enable-shared when building python