Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fails with "error: Rust build failed; unable to find any build artifacts" #286

Closed
Krenodeno opened this issue Aug 31, 2022 · 6 comments · Fixed by #290
Closed

build fails with "error: Rust build failed; unable to find any build artifacts" #286

Krenodeno opened this issue Aug 31, 2022 · 6 comments · Fixed by #290

Comments

@Krenodeno
Copy link

Hi,

I get an error "error: Rust build failed; unable to find any build artifacts" which originated from setuptools-rust https://github.com/PyO3/setuptools-rust/blob/v1.5.1/setuptools_rust/build.py#L284 even if rustc/cargo show no error ("Finished release [optimized] target(s) in 38.90s").

The rust lib build fine, but for any reason, setuptools-rust seems to not find artifacts.

My rust project is a single lib.rs file, compiled with cargo 1.63, setuptools-rust is v1.5.1 and pip is v22.2.1.


I tried trying running the rustc line outputed while building with cargo build -v, which output is the following:

rustc --crate-name mylib --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type dylib --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="python3"' -C metadata=a67764a0478247b2 --out-dir /home/me/mylib/target/debug/deps -C incremental=/home/me/mylib/target/debug/incremental -L dependency=/home/me/mylib/target/debug/deps --extern cpython=/home/me/mylib/target/debug/deps/libcpython-595113d75631677a.rlib --extern image=/home/me/mylib/target/debug/deps/libimage-3f31a25a1b7e2be8.rlib
{"artifact":"/home/me/mylib/target/debug/deps/watermarkrs.d","emit":"dep-info"}
{"artifact":"/home/me/mylib/target/debug/deps/libwatermarkrs.so","emit":"link"}

Looking at https://github.com/PyO3/setuptools-rust/blob/v1.5.1/setuptools_rust/build.py#L691 could it be that the json output of rustc have changed, then the parsing doesn't work ?

@davidhewitt
Copy link
Member

Thanks for reporting. Can you share a minimal repro of your project configuration and your build process which shows the error? The cargo output has not changed and is handled correctly, so the cause is likely in your project configuration.

@Krenodeno
Copy link
Author

Okay, I made this minimal example based on the actual project architecture and configuration: https://github.com/Krenodeno/python-rust-reprod

I reproduce the error doing the following:

# python -m venv __env__
# source __env__/bin/activate
# pip install .

Still I don't understand because a month or two back, it worked fine.

I forgot to mentions we use CPython bindings, maybe that's the cause ?

@davidhewitt
Copy link
Member

Thanks, I will do my best to debug this in the next few days.

@captainGeech42
Copy link

captainGeech42 commented Sep 17, 2022

+1, I'm experiencing what is likely the same underlying issue trying to build googleprojectzero/weggli. The rust code builds fine.

$ cargo -V
cargo 1.60.0 (d1fd9fe 2022-03-01)

$ python -V
Python 3.10.7

$ pip freeze | grep setuptools-rust
setuptools-rust==1.5.1

@captainGeech42
Copy link

I was able to successfully build by changing kind="cdylib" to kind="dylib" here. Not sure on the ramifications of this, but it worked for this specific build (host OS is Linux fwiw).

The relevant artifact output from Cargo is:

{"reason":"compiler-artifact","package_id":"weggli 0.2.4 (path+file:///home/geech/sec/weggli)","manifest_path":"/home/geech/sec/weggli/Cargo.toml","target":{"kind":["rlib","dylib"],"crate_types":["rlib","dylib"],"name":"weggli","src_path":"/home/geech/sec/weggli/src/lib.rs","edition":"2018","doc":true,"doctest":true,"test":true},"profile":{"opt_level":"3","debuginfo":null,"debug_assertions":false,"overflow_checks":false,"test":false},"features":["pyo3","python"],"filenames":["/home/geech/sec/weggli/target/release/libweggli.rlib","/home/geech/sec/weggli/target/release/libweggli.so"],"executable":null,"fresh":true}

@davidhewitt
Copy link
Member

#290 should fix this, I'll try to put out a release within a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants