Skip to content

Stubgen does not respect RPath for transitive dependencies #21543

@dbs4261

Description

@dbs4261

Bug Report
I have a library built with pybind11 that transitively links to libssl. Libssl in turn goes to load libcrypto, but gets the wrong version because it loads the system version, rather than using the $ORIGIN rpath in libssl. I ran stubgen under the debugger instead and found more strange behavior. The debugger stops on with ModuleInspect() as inspect: inside find_module_paths_using_imports but gives me a stack trace into the forkserver code. If I just put a breakpoint on that line in stubgen, and import my module, everything imports fine. However, stubgen gives me "Failed to import, skipping with error: /usr/lib/x86_64-linux-gnu/libcrypto.so.3: version `OPENSSL_3.6.0' not found (required by vcpkg/installed/x64-linux-dynamic/lib/libssl.so.3)"

To Reproduce

TODO: this might take some time for me to create a minimal example to reproduce it.

Actual Behavior

Failed to import, skipping with error: /usr/lib/x86_64-linux-gnu/libcrypto.so.3: version `OPENSSL_3.6.0' not found (required by vcpkg/installed/x64-linux-dynamic/lib/libssl.so.3)

Your Environment

  • Mypy version used: 2.1.0
  • Mypy command-line flags: stubgen.py -o ./stubs -m my_module
  • Mypy configuration options from mypy.ini (and other config files):
  • Python version used: 3.14.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions