pytorch / multipy

torch::deploy (multipy for non-torch uses) is a system that lets you get around the GIL problem by running multiple Python interpreters in a single C++ process.
Other
174 stars 35 forks source link

Local build fails with relocation error #302

Closed albanD closed 1 year ago

albanD commented 1 year ago

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 1 year ago

So, have you tried recompiling with -fPIC? ;)

https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html

albanD commented 1 year ago

My bad, I'm indeed missing the --enable-shared argument when configuring my local CPython install.