-
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/config relative paths in rustflags #7433
Comments
I do not believe this will really work even if .cargo/config rustflags is modified to know about relative paths. In the cargo configuration example here however, I believe if baz/ depends on a crate quux/.cargo/config is not consulted meaning that if quux/.cargo/config specifies a relative path |
The way I've seen
So it applies when compiling any crate under |
The potential fragility i'm concerned about, is if we were to try and embed your team's repository in a If I understand, the .cargo/config will work fine, when building from your workspace at top-level. I'm not exactly familiar with a case which requires one to pass -L in this way, so i'm struggling a bit to figure out how to produce an example which shows the option working for team joshlf but failing for team rustafarians, so i'm not exactly sure my concern here is truly justifiable. |
Sorry for the late reply. Concretely, our (Fuchsia's) build system has a single global directory into which all build artifacts are put. So what we'd like to do here is be able to have our However, I'd like to offer a simpler justification: This feature wouldn't change the behavior of the existing use case of absolute paths - it would only add a new use. If users of |
joshlf: I think i see now, what confused me is that If I add Fuchsia as a git submodule to |
Ah I see your confusion. Concretely, our tree is organized like this:
The |
My inclination be to attempt to ensure the path's don't escape Unfortunately that doesn't appear to work for your case, as it doesn't appear that Anyways what you say is true, nothing is stopping anyone from commiting hard coded paths already. |
I think we'd be OK with the restriction that paths don't escape Given that, do you think it'd be reasonable to just allow the feature as originally proposed, with relative paths being evaluated relative to the |
@joshlf I suppose in the sense that it's perhaps too late to add a restriction on the paths. I believe this feature request, does not make an existing problem any worse. I think that's as diplomatic as I can be. So I suppose yes, it could be construed as reasonable. |
It looks like #12193 is a duplicate of this but as it has more discussion from the cargo team, I'm going to close this issue. If I missed something, let us know! |
Describe the problem you are trying to solve
I'd like to be able to set the
rustflags
key to a path which is relative to the location of the.cargo/config
file (e.g.,rustflags = ["-L", "../../out/libs"]
) and have it work regardless of wherecargo
is invoked from.Describe the solution you'd like
I could see multiple possible solutions:
-L
to the compiler, and whose argument is interpreted as a relative path just like other key arguments already are./xxx
or../xxx
inrustflags
as a relative path, and modify it as appropriateMaybe there's a better, third option though.
The text was updated successfully, but these errors were encountered: