PyO3 / maturin

Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages
https://maturin.rs
Apache License 2.0
3.36k stars 227 forks source link

CARGO=cross uses wrong --manifest-path #2089

Closed XeCycle closed 2 weeks ago

XeCycle commented 2 weeks ago

Bug Description

 $ CARGO=cross maturin build -r
🍹 Building a mixed python/rust project
πŸ”— Found pyo3 bindings with abi3 support for Python β‰₯ 3.8
🐍 Not using a specific python interpreter
error: manifest path `/home/xecycle/<REDACTED>/Cargo.toml` does not exist
πŸ’₯ maturin failed
  Caused by: Failed to build a native library through cargo
  Caused by: Cargo build finished with "exit status: 101": `env -u CARGO "cross" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" "/home/xecycle/<REDACTED>/Cargo.toml" "--release" "--lib"`

Inside cross container the project should be at /project, and thus manifest path should be /project/Cargo.toml.

Your maturin version (maturin --version)

1.5.1

Your Python version (python -V)

3.8.18

Your pip version (pip -V)

24.0

What bindings you're using

pyo3

Does cargo build work?

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

Steps to Reproduce

Project directory layout is like

Cargo.lock
Cargo.toml
Cross.toml
pyproject.toml
python/<REDACTED>/__init__.py
src/lib.rs

and pyproject.toml contains

[tool.maturin]
python-source = "python"
module-name = "PACKAGE_NAME.RUST_MODULE_NAME"

Run CARGO=cross maturin build -r.

cross version is 0.2.5.

messense commented 2 weeks ago

/project was removed in future cross version, you are better off configure the mount in Cross.toml to the same as host path.

See https://github.com/cross-rs/cross/issues/938

XeCycle commented 2 weeks ago

Thank you, didn't know that change in cross...