-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo doesn't support config relative paths for rustc|rustc_wrapper|rustc_workspace_wrapper|rustdoc #8202
Comments
I don't think the meaning can be changed, as that would be a breaking change. We have two changes we are planning that might help:
Unfortunately we don't really have much of a design written down for these, yet. |
I'm totally new to this code, but from the following inside of /// Resolves this configuration-relative path to either an absolute path or
/// something appropriate to execute from `PATH`.
///
/// Values which don't look like a filesystem path (don't contain `/` or
/// `\`) will be returned as-is, and everything else will fall through to an
/// absolute path.
pub fn resolve_program(self, config: &Config) -> PathBuf {
config.string_to_path(self.0.val, &self.0.definition)
} |
Making this change locally appears to work correctly for my test workspace with a relative path rustc, and passes the Cargo repo's |
Actually, this is (or is related to) a regression (or at least jarring behavior change) in stable Cargo. For my thesis work, I have a custom
This actually works on cargo up through at least 0.40.0 (aka "1.39.0" according to --version), but broke sometime between then and 0.43.1 (aka "1.42.1"). Specifically, under the latter version, it now fails to find the script while building dependencies, as in this example:
Running it under I did this entire comparison with |
Actually, I take back what I said about
Here's a minimal example for reproducing this:
.cargo/config .cargo/rustc |
Another interesting tidbit about @rickvanprim's
I'm curious to know whether @rickvanprim's issue reproduces on 0.40.0; if so, these lines are not the cause of the regression even though they are an apparent fix, and if not, my issue is actually a different one. |
@solb I'm not sure. I've stopped using Cargo for anything other than projects that happen to exactly fit Cargo's view of the world. I found some other working directory stuff here #8506 (comment). I think you may be able to work around this behavior using the improved rust-toolchain.toml stuff. Either by giving that a path to your wrapper (as it resolves relative to the TOML file), or by defining your own toolchains that are defined in and local to your repo, and then letting the host resolution pick the appropriate version. |
Interesting workaround. I don't currently use rustup, though, and don't really want to introduce it as a dependency. |
Sorry, when this was opened I think I misunderstood the situation. I have posted #9566 to fix this. |
I can confirm this is fixed in cargo 1.55.0, released yesterday. Thanks @ehuss! |
Problem
When attempting to set a relative path for
rustc|rustc_wrapper|rustc_workspace_wrapper|rustdoc
in the Cargo Config[build]
section, the build is dependent on the working directory Cargo chooses for any given build step. As a result, runningcargo build --manifest-path=my_workspace_crate/Cargo.toml
from the workspace root doesn't work because part of the process looks forrustc
relative to the root of the workspace, and part looks relative to the root ofmy_workspace_crate
.Steps
rustc
inside.cargo/config
cargo clean
.--manifest-path
or as part of a workspace.rustc
.Possible Solution(s)
Inside of
src/cargo/util/config/mod.rs
changeCargoBuildConfig
'srustc|rustc_wrapper|rustc_workspace_wrapper|rustdoc
fromOption<PathBuf>
toOption<ConfigRelativePath>
Notes
Output of
cargo version
: cargo 1.44.0-nightly (8751eb3 2020-04-21)The text was updated successfully, but these errors were encountered: