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

Unnecessary rebuilds due to ineffective path changes #2308

Closed
adamreichold opened this issue Apr 15, 2022 · 5 comments
Closed

Unnecessary rebuilds due to ineffective path changes #2308

adamreichold opened this issue Apr 15, 2022 · 5 comments
Labels

Comments

@adamreichold
Copy link
Member

Bug Description

I noticed that for several crates, pyo3-build-config and its dependencies are rebuilt between running cargo clippy and cargo test. Looking into Cargo's debug log, I found

[2022-04-15T08:53:35Z INFO  cargo::core::compiler::fingerprint] fingerprint error for pyo3-build-config v0.16.4/RunCustomBuild/TargetInner { ..: custom_build_target("build-script-build", "/home/adam/.cargo/registry/src/github.com-1ecc6299db9ec823/pyo3-build-config-0.16.4/build.rs", Edition2018) }
[2022-04-15T08:53:35Z INFO  cargo::core::compiler::fingerprint]     err: env var `PATH` changed: previously Some("/home/adam/.cargo/bin:/home/adam/.cargo/bin:/home/adam/.local/bin:/home/adam/.local/bin:/home/adam/bin:/usr/local/bin:/usr/bin:/bin"), now Some("/home/adam/.cargo/bin:/home/adam/.cargo/bin:/home/adam/.cargo/bin:/home/adam/.cargo/bin:/home/adam/.local/bin:/home/adam/.local/bin:/home/adam/bin:/usr/local/bin:/usr/bin:/bin")

which seems to be Cargo or Rustup adding additional directories to PATH (but they are the same as the existing ones).

I am not actually sure that we can do anything about this in PyO3 or if rather Cargo or Rustup need to be changed to be more clever about changing path. (I am still not sure who changes the PATH environment variable (and similarly LD_LIBRARY_PATH), but I think it must be Rustup as it should be the only one knowing about these paths.)

Steps to Reproduce

For example, running ./x.py on the code from PyO3/rust-numpy#322 will show the behaviour described above.

Backtrace

No response

Your operating system and version

OpenSUSE Tumbleweed

Your Python version (python --version)

3.8.13

Your Rust version (rustc --version)

22.0.4

Your PyO3 version

0.16.4

How did you install python? Did you use a virtualenv?

System-wide installation via package manager.

Additional Info

No response

@adamreichold
Copy link
Member Author

From running strace, I think it is actually Cargo doing this.

@davidhewitt
Copy link
Member

See also #1708 and rust-lang/rustup#2849 - it would be great to get to the bottom of this!

@adamreichold
Copy link
Member Author

I think this indeed a duplicate of #1708. I am not sure if the rustup change will sufficient as the following code from Cargo might still produce duplicates AFAIU: https://github.com/rust-lang/cargo/blob/1073915930bf36f39472b0d223c125a3b51a9080/src/cargo/core/compiler/compilation.rs#L261

@davidclevenger
Copy link

Are there steps to resolve this? This issue is still persisting for me.

@davidhewitt
Copy link
Member

Configuring CARGO_TARGET_DIR for rust-analyzer usually resolves this for me.

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

No branches or pull requests

3 participants