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

Add an option to use relative paths or full paths when building projects #11043

Closed
tenderlove opened this issue Sep 1, 2022 · 3 comments
Closed
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@tenderlove
Copy link

Problem

We are using Rust / Cargo to develop a JIT for Ruby called YJIT. YJIT is kind of a sub project of the Ruby programming language. The Ruby programming language is written in C and uses normal C build tools (autoconf, make, etc). YJIT is a subproject, but we've integrated the build in to the normal Ruby compilation process. However, if there is any problem compiling the Rust files, the reported file will be relative to the YJIT directory and not the working directory. This causes a problem with Vim (and apparently other IDEs #8506) because they can't find the file.

Here is a screenshot to kind of illustrate the problem:

ruby — fish :home:aaron:git:ruby — ssh whiteclaw — 188×59 2022-09-01 11-50-08

I would like a command line option to ask Cargo to report either full paths, or paths relative to the current working directory.

Proposed Solution

I would like a command line option that allows me to see files either as a full path, or as a path relative to the current working directory.

Notes

I found this issue which is similar, and they said it should be a feature request instead of a bug, so I'm filing a feature request.

We have a constraint in the Ruby project that we can't just move the Cargo.toml file to the root of the directory. Additionally I spend my time changing the C source code in tandem with Rust source code, so presumably I could keep changing Vim's working directory depending on what I'm editing, but that's kind of onerous.

Thanks for your time!!

@tenderlove tenderlove added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Sep 1, 2022
@tenderlove
Copy link
Author

Sorry, I should have also mentioned that our Make system is just calling cargo with --manifest-path. So without make involved, the issue is like this:

ruby — fish :home:aaron:git:ruby — ssh whiteclaw — 188×59 2022-09-01 12-02-37

@weihanglo
Copy link
Member

There are some complications about caching artifacts and metadata when changing paths in Cargo. Here is one thread discussing such issue.

You could check this rustc flag --remap-path-prefix to see if it works for you. Something like:

RUSTFLAGS='--remap-path-prefix =yjit' cargo b

@epage
Copy link
Contributor

epage commented Oct 19, 2023

This appears to be duplicate of #5450, closing in favor of that.

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

4 participants