Description
After setting up a NAS device (exfat over smb via RPI3), Rust has trouble compiling any project stored on that device. This isn't so much a problem with the Rust compiler as it is with my awkward NAS setup.
Here's an ascii diagram to illustrate:
+----------------+ +-------------+
| local computer | | NAS |
+----------------+ +-------------+
| compiler <-------- source code |
| | ^ | | |
| | | | | |
| | +-------------> /target |
| v | | | |
| binary <------------+ |
| | | +-------------+
| v |
| run |
+----------------+
The idea is that the source code is hosted on the NAS (slow but lots of storage), and compiled/run on the local machine (fast but less storage).
The main driver of the error is simple: Rust is unable to 'create [a] session directory lock file' due to os error 45
. After some quick digging, it appears that this error primarily occurs when a device is not connected and access is attempted (which is not the case here - the device is connected, albeit over a network).
I primarily believe that this error is occurring due to the limitations of the smb protocol (and not due to the fact that this drive is formated as exfat; if the device is physically connected, Rust code compiles fine). This error also seems to occur in relation to incremental builds, though that may simply be because that is what the compiler checks for first.
I could just disable incremental compilation - while fixing the error, it still does not fix incremental compilation over remote file systems. I'm pretty sure this issue is fairly unique, but if there is already an issue that discusses this particular topic, please just ignore this one.
Thank you in advance for any help 😄.
Code
Anything and everything - the compiler will not start compiling.
Meta
rustc --version --verbose
:
rustc 1.45.2 (d3fb005a3 2020-07-31)
binary: rustc
commit-hash: d3fb005a39e62501b8b0b356166e515ae24e2e54
commit-date: 2020-07-31
host: x86_64-apple-darwin
release: 1.45.2
LLVM version: 10.0
Error output
cargo run --verbose
Compiling error v0.1.0 (/Volumes/drive/repos/error)
Running `rustc --crate-name error --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=75b64579dca9fefb --out-dir /Volumes/drive/Repos/error/target/debug/deps -C incremental=/Volumes/drive/Repos/error/target/debug/incremental -L dependency=/Volumes/drive/Repos/error/target/debug/deps`
error: incremental compilation: could not create session directory lock file: Operation not supported (os error 45)
thread 'rustc' panicked at 'trying to get session directory from `IncrCompSession`: NotInitialized', src/librustc_session/session.rs:840:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.45.2 (d3fb005a3 2020-07-31) running on x86_64-apple-darwin
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: aborting due to previous error
error: could not compile `error`.
Caused by:
process didn't exit successfully: `rustc --crate-name error --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=75b64579dca9fefb --out-dir /Volumes/drive/Repos/Veritable/error/target/debug/deps -C incremental=/Volumes/drive/Repos/Veritable/error/target/debug/incremental -L dependency=/Volumes/drive/Repos/Veritable/error/target/debug/deps` (exit code: 101)
Backtrace
No backtrace, even when RUST_BACKTRACE=1
is set.