You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, CMake(pybind11) may use relative path (relative to the build location) when link the third-party library. Then after setuptools copies the generated my_proj.cpythonxxxx.so to python's site-packages, I would encounter the following error when I try to import the lib (python -c "import my_proj"):
ImportError: ../../../api/lib/libthirdparty.so: cannot open shared object file: No such file or directory
For that CMake build the project under some folder like build/tmp.xxx/my_proj, then the path is resolved as ../../../api.... Even worse, when setuptool copies my_proj.cpythonxxxx.so to site-packages, the relative path becomes even ridiculous.
I am not familiar with CMake and have tried several CMake commands (from Google) and all of them fail. So, maybe someone here could help me, and I do think there should be a very simple solution.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am working on a c++ extension that using a third-party c++ dynamic library (assume its name as
libthirdparty.so
), and my project folder looks like:As I am using CMake to build my project, link a third-party library would be like:
However, CMake(pybind11) may use relative path (relative to the build location) when link the third-party library. Then after
setuptools
copies the generatedmy_proj.cpythonxxxx.so
to python's site-packages, I would encounter the following error when I try to import the lib (python -c "import my_proj"
):For that CMake build the project under some folder like
build/tmp.xxx/my_proj
, then the path is resolved as../../../api...
. Even worse, whensetuptool
copiesmy_proj.cpythonxxxx.so
to site-packages, the relative path becomes even ridiculous.I am not familiar with CMake and have tried several CMake commands (from Google) and all of them fail. So, maybe someone here could help me, and I do think there should be a very simple solution.
Beta Was this translation helpful? Give feedback.
All reactions