pybind / pybind/cuda_example

Bindings for a shared library

Open
#11 11 comments 12 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
670
Forks
219
Avg merge
8d 2h
Merged PRs (30d)
1

Description

If I am wrapping a shared library (e.g. libParent.so), and generate python bindings (e.g. libBindings.so), setup.py will install both libBindings.so (correctly) and libParent.so (incorrectly) to python's .../dist-packages/. .../dist-packages/ directory is not usually in $LD_LIBRARY_PATH, so the loader does not see libParent.so and I get an error like this:

ImportError: libParent.so.0.0.1: cannot open shared object file: No such file or directory

Contents of Bindings/CMakeLists.txtlook like this:

pybind11_add_module(Bindings bindings.cpp)
target_link_libraries(Bindings PRIVATE Parent)

Is there an elegant way to solve this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Bindings/CMakeLists.txt and the setup.py packaging path, then reproduce the import error involving libParent.so. Determine how the generated binding and its shared-library dependency are installed and loaded; done when the binding imports successfully without incorrectly installing or hiding the parent library.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.