Local build fails with relocation error
albanD opened this issue · 2 comments
albanD commented
A local build with latest PyTorch with a local build of CPython 3.11 leads to many errors similar to:
/usr/bin/ld: libpython_multipy.a(abstract.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libpython_multipy.a(boolobject.o): relocation R_X86_64_32S against symbol `_Py_TrueStruct' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libpython_multipy.a(bytearrayobject.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: libpython_multipy.a(bytesobject.o): relocation R_X86_64_32S against symbol `_PyRuntime' can not be used when making a shared object; recompile with -fPIC
Any idea what could be the problem?
malfet commented
So, have you tried recompiling with -fPIC
? ;)
https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html
albanD commented
My bad, I'm indeed missing the --enable-shared
argument when configuring my local CPython install.