I have a pyo3 py/rust project. I've stripped it down to, a simple Rust function, a rust function which links to pyo3, and one which links to pyo3 and exposes itself to the python env(all shown below). cargo test fails with a linker error. Which looks like it can't statically build vs the libpython.so. I have toolchains managed by rye and all are present and contain the dev libs:
Steps to Reproduce
Full repro here git@github.com:nazq/maturin_cargo_build_repro.git
I have a pyo3 py/rust project. I've stripped it down to, a simple Rust function, a rust function which links to pyo3, and one which links to pyo3 and exposes itself to the python env(all shown below).
cargo test
fails with a linker error. Which looks like it can't statically build vs the libpython.so. I have toolchains managed by rye and all are present and contain the dev libs:cargo test fails with (on a py3.10 toolchain):
= note: /usr/bin/ld: cannot find -lpython3.10: No such file or directory collect2: error: ld returned 1 exit status
I was able to get this to build by doing the following (see https://github.com/nazq/maturin_cargo_build_repro/blob/main/Makefile#L4 for details).
Feels like there is an issue with how the rye environments are exposed to the pyo3/cargo build. Happy to cross post there
Expected Result
cargo test should work as is.
Actual Result
cargo test fails with (on a py3.10 toolchain):
= note: /usr/bin/ld: cannot find -lpython3.10: No such file or directory collect2: error: ld returned 1 exit status
Version Info
maturin_cargo_build_repro🐍 v3.10.13 ❯ rye --version rye 0.31.0 commit: 0.31.0 (72e239b8f 2024-03-22) platform: linux (x86_64) self-python: cpython@3.12.2 symlink support: true uv enabled: true
Stacktrace
No response