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

Change build directory #3544

Open
MGlolenstine opened this issue Mar 10, 2020 · 9 comments
Open

Change build directory #3544

MGlolenstine opened this issue Mar 10, 2020 · 9 comments
Labels
S-unactionable Issue requires feedback, design decisions or is blocked on other work

Comments

@MGlolenstine
Copy link

I'm loving rust-analyzer so far, but there's a problem I'm facing.
I'm compiling for armv7, and whenever I want to build, I have to rebuild the whole package, because cargo check rebuilds all dependencies for x86_64 (I think, because it doesn't have to rebuild everything when the extension is disabled).

Now I'd like to know if there's a way to change the build directory, just so that I could use both programs and not have to wait 5min between deploys.

@bjorn3
Copy link
Member

bjorn3 commented Mar 10, 2020

When building for a different target, cargo should use a different build directory. (eg target/<target triple>/debug instead of target/debug)

@lnicola
Copy link
Member

lnicola commented Mar 10, 2020

Are you setting any rustc or cargo flags using environment variables? That might explain why cargo is rebuilding crates if your editor doesn't inherit the same ones. Does it happen if you build from the Code terminal? We've had another report of this, but I can't really look it up right now.

@lnicola
Copy link
Member

lnicola commented Mar 10, 2020

#3270

@MGlolenstine
Copy link
Author

I'm compiling using cross build --target=armv7-unknown-linux-gnueabihf, and I did try changing the --target-dir, by adding it to RustAnalyzer > Cargo-watch: Arguments in the rust-analyzer settings to another folder inside the project folder, I also tried an absolute path, but neither worked.

@MGlolenstine
Copy link
Author

So if I understand correctly from this, there's currently no way to replace the path, that the default Rust analyzer: run uses for the cargo check -p <projectname>? If I run it manually with the --target-dir <abs path to tmp folder> it doesn't interfere at all.

@davemilter
Copy link

@bjorn3

When building for a different target, cargo should use a different build directory

There is cargo bug: rust-lang/cargo#7822 and rust-lang/cargo#6375 ,
so cargo check cargo check --target= can influence each other, though artifact go to different directories.

@lnicola lnicola added S-actionable Someone could pick this issue up and work on it right now S-unactionable Issue requires feedback, design decisions or is blocked on other work and removed S-actionable Someone could pick this issue up and work on it right now labels Jan 27, 2021
@lnicola
Copy link
Member

lnicola commented Jan 27, 2021

@MGlolenstine are you still seeing this? If yes, can you please put up a sample project where you see cargo rebuilding too much?

@MGlolenstine
Copy link
Author

I haven't worked on that project since the last time we spoke, but I will take a look and report.

@kaimast
Copy link

kaimast commented Nov 18, 2021

I still see this problem. More details are in rust-lang/cargo#8716.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-unactionable Issue requires feedback, design decisions or is blocked on other work
Projects
None yet
Development

No branches or pull requests

5 participants