How to package external shared object file
safijari opened this issue · 4 comments
Unsure the correct place to ask this, if an issue is not a proper venue kindly point me to a better one and I will ask the question there.
I'm trying to wrap a C++ class that in turn a wrapper over a 3rd party library. The library supplies a single .so file that I can link against. I have everything working but can't figure out how to package my code in a way so that I can deploy it as a wheel and have it work correctly in a virtualenv without the user having to install this 3rd party library's .so file. I know that I can copy the .so file into the target computer's /usr/lib
and then things work fine but I'm wondering if there is a better solution.
@safijari did you ever solve this? I have the exact use case and right now I have to set LD_LIBRARY_PATH
with the path to the library before launching Python.
Yessir. The canonical answer is using auditwheel (which uses the patchelf utility in the backend). This will of course be platform dependent. If you want to maximize compatibility you need to build these wheels in a manylinux1 container (CentOS 5).
My repos https://github.com/safijari/apriltags2_ethz/ and https://github.com/safijari/open_karto/ use this approach alongside a utility called cibuildwheel to make these maximally compatible Linux wheels in Travis ci and appveyor. They also use a container I build myself that has additional dependencies installed (boost, opencv, etc)
Please let me know if you have any other questions.
I'm closing this since I found a solution.