Skip to content

Incremental compilation does not work through mounted WSL folder on Windows #12650

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
printfn opened this issue Sep 9, 2023 · 1 comment
Closed
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@printfn
Copy link

printfn commented Sep 9, 2023

Problem

I have cargo installed via rustup on Windows, and cargo build fails with this error message when trying to build inside of a mounted WSL directory (i.e. \\wsl.localhost\Ubuntu\home\user\...):

PS Microsoft.PowerShell.Core\FileSystem::\\wsl.localhost\Ubuntu\home\user\fend> cargo build
   Compiling fend-core v1.2.1 (\\wsl.localhost\Ubuntu\home\user\fend\core)
error: incremental compilation: could not create session directory lock file: Incorrect function. (os error -2147024895)
  |
  = help: incremental compilation can be disabled by setting the environment variable CARGO_INCREMENTAL=0 (see https://doc.rust-lang.org/cargo/reference/profiles.html#incremental)
  = help: the entire build directory can be changed to a different filesystem by setting the environment variable CARGO_TARGET_DIR to a different path (see https://doc.rust-lang.org/cargo/reference/config.html#buildtarget-dir)

error: could not compile `fend-core` (lib) due to previous error

Disabling incremental compilation with $env:CARGO_INCREMENTAL = "0" works, as does using a Linux version of cargo/rustc, but I was working on Windows-specific code and did not want to cross-compile, nor move my rust code outside WSL.

Steps

  1. Install rustup, cargo, rustc, etc. on Windows
  2. Set up a cargo project inside WSL
  3. Open a powershell window and run:
    cd \\wsl.localhost\Ubuntu\home\user\project
    $env:CARGO_INCREMENTAL = "0"
    cargo build

Possible Solution(s)

File locking should be fixed in this scenario, or incremental compilation should be disabled automatically.

Notes

No response

Version

cargo 1.72.0 (103a7ff2e 2023-08-15)
release: 1.72.0
commit-hash: 103a7ff2ee7678d34f34d778614c5eb2525ae9de
commit-date: 2023-08-15
host: x86_64-pc-windows-msvc
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:Schannel)
os: Windows 10.0.22621 (Windows 11 Professional) [64-bit]
@printfn printfn added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Sep 9, 2023
@ehuss
Copy link
Contributor

ehuss commented Sep 9, 2023

Thanks for the report! I'm going to close this as a duplicate of rust-lang/rust#49773 since it is a known issue that incremental is not compatible with filesystems that don't support locking.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants