Skip to content

Warning Message of cargo build when using vscode-remote of wsl #62031

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

Closed
AdmiralDollBug opened this issue Jun 21, 2019 · 18 comments
Closed

Warning Message of cargo build when using vscode-remote of wsl #62031

AdmiralDollBug opened this issue Jun 21, 2019 · 18 comments
Labels
O-linux Operating system: Linux

Comments

@AdmiralDollBug
Copy link

I'm learning Rust with Visual Studio Code and WSL, and I have installed the Rust(rls) plugin on vscode. But when I compile my project with cargo build command, warning message occured as follows:

hello_cargo git:(master) ✗ cargo build --verbose
   Compiling hello_cargo v0.1.0 (/home/admiraldollbug/rustTest/hello_cargo)
     Running rustc --edition=2018 --crate-name hello_cargo src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=2773c05304224b24 -C extra-filename=-2773c05304224b24 --out-dir /home/admiraldollbug/rustTest/hello_cargo/target/debug/deps -C incremental=/home/admiraldollbug/rustTest/hello_cargo/target/debug/incremental -L dependency=/home/admiraldollbug/rustTest/hello_cargo/target/debug/deps`
warning: Error finalizing incremental compilation session directory `/home/admiraldollbug/rustTest/hello_cargo/target/debug/incremental/hello_cargo-3fff4itd3xshd/s-fddic00q5j-2o52yu-working`: Permission denied (os error 13)

    Finished dev [unoptimized + debuginfo] target(s) in 0.97s

However, as you can see, the build process completed normally and meanwhile the cargo run command runs the program correctly. Another thing is that when i compile with the --release param, the warning doesnt emerge.
I'm wondering what the warning message means and what effect it would brings. I can't find the detail of this message on Google or on official doc, so I opened this issue.

@Centril Centril added the O-linux Operating system: Linux label Jun 21, 2019
@poupryc
Copy link

poupryc commented Jun 21, 2019

Can confirm the issue

λ cargo test --all
   Compiling cmark-gfm-sys v0.1.0 (/mnt/d/usr/dev/rust-cmark-gfm/cmark-gfm-sys)
warning: Error finalizing incremental compilation session directory `/mnt/d/usr/dev/rust-cmark-gfm/target/debug/incremental/build_script_build-n4xciywvi19s/s-fdds55f09n-q5jt9f-working`: Permission denied (os error 13)

warning: Error finalizing incremental compilation session directory `/mnt/d/usr/dev/rust-cmark-gfm/target/debug/incremental/cmark_gfm_sys-3ls9njfzb6ykh/s-fdds5eh9bn-12gpv22-working`: Permission denied (os error 13)

   Compiling cmark-gfm v0.1.0 (/mnt/d/usr/dev/rust-cmark-gfm)
warning: Error finalizing incremental compilation session directory `/mnt/d/usr/dev/rust-cmark-gfm/target/debug/incremental/cmark_gfm-z8zc4vraefh5/s-fdds5f2afx-cdxd8g-working`: Permission denied (os error 13)

warning: Error finalizing incremental compilation session directory `/mnt/d/usr/dev/rust-cmark-gfm/target/debug/incremental/cmark_gfm-deomkyug872w/s-fdds5f2gs3-1lwc7q9-working`: Permission denied (os error 13)

warning: Error finalizing incremental compilation session directory `/mnt/d/usr/dev/rust-cmark-gfm/target/debug/incremental/cmark_gfm_sys-191n3k9jxet3b/s-fdds5ehieo-11qz35a-working`: Permission denied (os error 13)

With WSL (pengwin / debian based) here

@teskje
Copy link

teskje commented Jul 7, 2019

I had the same issue and it looks like this is not a problem with Rust but with the vscode Remote extension. They employ a file watcher that listens to file events to be notified about changes to files in an opened folder. Somehow that locks the files and causes permission errors.

You can work around the compiler warnings by either configuring the file watcher to use polling instead of events or by excluding the target/ directory from being watched. You can read more about that here: https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace

@AdmiralDollBug
Copy link
Author

@ra-kete That works. Thank you a lot!

@95th
Copy link
Contributor

95th commented Jan 6, 2020

This issue is happening for me even without any vs-code instance running.

warning: Error finalizing incremental compilation session directory `/home/95th/btrs/target/debug/incremental/btrs-311gr3ac8npws/s-fjgujplfts-i503kt-working`: Permission denied (os error 13)

@arloan
Copy link

arloan commented Jan 22, 2020

This issue also happens to me, on debian10@WSL1. set vs-code remote.WSL.fileWatcher.polling to true does not help, exiting vs-code does not help, add wsl debian's rootfs folder to the excluding folder list of the Windows Defender does not help.

warning: Error finalizing incremental compilation session directory `/home/stone/projects/rabbit-dylib/target/debug/incremental/omcr-23necf7v4fs88/s-fjxwwz9bf3-7ohipt-working`: Permission denied (os error 13)

    Finished dev [unoptimized + debuginfo] target(s) in 0.13s

The last part of the warning path even does not exist, while the omcr-xxx folder exists:

stone@LAPTOP-Q3L7M1FS:~/projects/rabbit-dylib$ ll /home/stone/projects/rabbit-dylib/target/debug/incremental/
total 0
drwxrwxrwx 1 stone stone 4096 Jan 22 09:55 omcr-23necf7v4fs88
stone@LAPTOP-Q3L7M1FS:~/projects/rabbit-dylib$ ll /home/stone/projects/rabbit-dylib/target/debug/incremental/omcr-23necf7v4fs88/
total 0
stone@LAPTOP-Q3L7M1FS:~/projects/rabbit-dylib$

@zzy
Copy link

zzy commented Feb 27, 2020

I had the same issue and it looks like this is not a problem with Rust but with the vscode Remote extension. They employ a file watcher that listens to file events to be notified about changes to files in an opened folder. Somehow that locks the files and causes permission errors.

You can work around the compiler warnings by either configuring the file watcher to use polling instead of events or by excluding the target/ directory from being watched. You can read more about that here: https://code.visualstudio.com/docs/remote/wsl#_i-see-eaccess-permission-denied-error-trying-to-rename-a-folder-in-the-open-workspace

great!

@Umaigenomu
Copy link

This issue is happening for me even without any vs-code instance running.

warning: Error finalizing incremental compilation session directory `/home/95th/btrs/target/debug/incremental/btrs-311gr3ac8npws/s-fjgujplfts-i503kt-working`: Permission denied (os error 13)

delete the target folder, exclude future target folders from being watched with files.watcherExclude (e.g. "**/target/**": true), rebuild and you won't get the message anymore.

@95th
Copy link
Contributor

95th commented Jun 8, 2020

Still happening today without any VS code running

@gitpicard
Copy link

I have the same issue as @95th. Also happens without an instance of VS code running. Did you ever find a fix?

@pksunkara
Copy link
Contributor

I think this happens when you send SIGKILL to the cargo build process before it finishes. The next cargo build would emit this error.

@a5hk
Copy link

a5hk commented Oct 23, 2020

Upgrading to wsl2 and deleting the target folder solved the issue.

@pwaller
Copy link

pwaller commented Nov 4, 2020

I've reported one of the underlying issues against cargo here: rust-lang/cargo#8830. I think there might be multiple underlying issues, one of which is that cargo doesn't seem to be safe when run concurrently. I haven't yet looked/raised one for that.

This underlying issue is that cargo is showing cached build output. If that output printed an error, but succeeded, cargo would repeatably show the error output from the previous build. Hence seeing things like permission errors which are no longer present, or attempting to delete files which no longer exist.

@Loongphy
Copy link

I close the VS Code, delete the ./target and reboot the WSL. Then cargo build, it runs without any error.

@Loongphy
Copy link

I tried again. cargo build with VS Code get warnings. If I close the VS Code, everything goes well. So it's the VS Code's problem.

@wycats
Copy link
Contributor

wycats commented Dec 9, 2020

@Dragonphy did you try adding target/** to your files.watcherExclude in settings.json?

@yanshenxian
Copy link

I have the same issue with WSL1. Just add **/target/** (instead of target/**) to files.watcherExclude and delete the existed target directory, then cargo runs without any warning.

image

@taorye
Copy link

taorye commented Jan 9, 2021

@yanshenxian it works, thank you 👍

@marsonparulian
Copy link

This issue is happening for me even without any vs-code instance running.

warning: Error finalizing incremental compilation session directory `/home/95th/btrs/target/debug/incremental/btrs-311gr3ac8npws/s-fjgujplfts-i503kt-working`: Permission denied (os error 13)

delete the target folder, exclude future target folders from being watched with files.watcherExclude (e.g. "**/target/**": true), rebuild and you won't get the message anymore.

I also got the warning when running cargo test in Powershell.
$ cargo clean solved the problem.
Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-linux Operating system: Linux
Projects
None yet
Development

No branches or pull requests