-
-
Notifications
You must be signed in to change notification settings - Fork 17
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 dependency on CARGO_ENCODED_RUSTFLAGS
causes needless rebuilds
#151
Comments
This is probably due to maturin setting as CARGO_ENCODED_RUSTFLAGS what was originally set as RUSTFLAGS. If so, changing this line to the following would fix the rebuild problem (although that is not a better fix here). From:
To:
I think a better fix here is to add a method like encode_preserve that respects the format of the rustflags source to in cargo-config2 and change maturin to use that. |
I have managed to make a reproducible example: portable-atomic-maturin.zip Typing: cargo build --all-targets -vv
maturin develop -vv
cargo test -vv will show for the last two commands:
This is only reproducible if the following is added in `.cargo/config.toml': [target.'cfg(target_arch = "x86_64")']
rustflags = "--codegen target-cpu=x86-64-v3" |
Ah, that's a tricky issue involving interaction with config. If cargo fixes a bug (rust-lang/cargo#13003), there would be no need for |
I'm not sure I fully understand. Printing the content of the env var in (I've not tried your proposal yet, maturin is non trivial to rebuild from source and test) |
Thanks to the detailed information provided, this turned out to be an irrelevant issue. |
In my understanding, what is happening:
There are several possible fixes here:
|
Opened PyO3/maturin#1978 with this approach. |
PyO3/maturin#1978 has been released in maturin 1.5.0. |
You are an absolute hero! Impressive rollout with a new release of maturin within 24h of raising this initial issue. We've tested maturin 1.5.0 and can confirm it fixes the rebuild issues. Timings of the CI/CD pipeline are much better. |
FYI, the underlying Cargo bug has been fixed in the latest stable (1.79), and in the latest portable-atomic, the workaround in the portable-atomic side is only used for old Cargo. Lines 65 to 72 in 6cc21f3
|
In our CI/CD, we do something along the following lines:
cargo build --all-targets maturin develop --manifest-path src/python_bindings/Cargo.toml cargo test
The problem is that
portable-atomic
has a build dependency onCARGO_ENCODED_RUSTFLAGS
, seeportable-atomic/build.rs
Line 41 in 0479f5b
For some reason,
portable-atomic
is built each time (3 times) rather than once. Maturin passes the exact sameCARGO_ENCODED_RUSTFLAGS
environment variable as Cargo does, but the rebuild is still triggered by Cargo, saying that the aforementioned environment variable has changed. Adding debug printing (with proper non-ASCII escaping) in theportable-atomic
build.rs
file confirms that the env var is identical on each command.This could be very a bug in
cargo
itself, but sinceportable-atomic
is the only crate I've encountered with this build-time dependency, I thought the would be the right place for an initial issue report.The text was updated successfully, but these errors were encountered: