LoginSignup
9
4

More than 3 years have passed since last update.

VSCode上のWSLからCargoでビルドするとError finalizing incremental compilation session directoryと出るやつの解決策

Posted at

本日Rustを完全に理解した勢のもみにすです。
VSCode+WSLで悠々自適なRust生活を送ろうと思っていたところ、cargo run

warning: Error finalizing incremental compilation session directory `/mnt/c/Users/JosephJoestar/rust-test/target/debug/incremental/tuto-10gfyla9jwt3t/s-fj6wf8ds1g-11v4hjj-working`: Permission denied (os error 13)

image.png

こいつを吐きました。

rust-lang/rust #62031 Warning Message of cargo build when using vscode-remote of wslというissueがGitHubのRustに上がっていますが、これはRustの問題ではないようです。

I see EACCESS: permission denied error trying to rename a folder in the open workspace

That's a known problem with the WSL file system implementation (Microsoft/WSL#3395, Microsoft/WSL#1956) caused by the file watcher active by VSCode. The issue will only be fixed in WSL 2.

To avoid the issue, set remote.WSL.fileWatcher.polling to true. However, polling based has a performance impact for large workspaces.

For large workspace you want to increase the polling interval: remote.WSL.fileWatcher.pollingInterval and control the folders that are watched: files.watcherExclude.

WSL 2 does not have that file watcher problem is also not affected by the new setting.

要約すると、

VSCodeのファイル監視に起因するWSLのファイルシステム周りの問題で、WSL2では起きない

VSCodeの設定からremote.WSL.fileWatcher.pollingtrueにすればいいんだが、ワークスペースがでかくなったときにパフォーマンスに悪影響が出る

remote.WSL.fileWatcher.pollingIntervalからpollingの間隔を開けたり、files.watcherExcludeで監視対象のフォルダーを制御したりするといい

ではVSCodeのsettings.jsonを開いて、以下の設定を追加してみます。

settings.json
{
    "files.watcherExclude": {
        "**/target/**": true
    }
}

image.png
出なくなった。これですっきり。

9
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
4