pybind / pybind/pybind11

[BUG]: Can't include 3rd shared libraries

Open
#5,367 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

Required prerequisites
What version (or hash if on master) of pybind11 are you using?

2.13.5

Problem description

I'm using pybind11 in the project piper-phonemize-fork which has 2 shared libraries dependencies (onnxruntime and espeak-ng).
I can't import the extension because it doesn't find the 2 shared libraries which I included in the package.
Even when modifying LD_LIBRARY_PATH on Linux and or DYLD_LIBRARY_PATH on macOS or PATH on Windows.
It just says that it can't find the extension but the issue is that the extension fail to load the shared libraries.
It can import ONLY if the extension and the shared libraries are placed in the same folder, but for some reason the extension file is placed in site-pacakges rather than the package folder.

My suggestion:

  1. Provide a way to place the extension in the package folder rather than site-packages
  2. Provide a cross platform solution to include the shared libraries in the package and to be able to import the extension.
  3. Add documentation. I noticed at least 3 projects which I contributed to and the developers struggle with this exact issue.

People use auditwheel or delocate or cibuildwheel or delvewheel
While these tools can sometimes simplify, I prefer not to use them in simple projects.

Reproducible example code

setup.py
CMakeLists.txt

Is this a regression? Put the last known working version here if it is.

Not a regression

Contributor guide

Open the contributing guide

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

Begin by comparing the linked setup.py and CMakeLists.txt, then reproduce the extension import failure with the bundled onnxruntime and espeak-ng libraries on the affected platforms. Done would require a clearly scoped, cross-platform solution or documentation explaining how to package and load these shared libraries without relying on platform-specific path changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, python
Domain
build-system, documentation
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.