Unable to setup 'rustc' on windows 11

I'm trying to setup 'rustc' compiler on Windows 11 by following the quickstart guide Quickstart - Rust Compiler Development Guide

Since it is windows, I'm running the powershell script x.ps1 like below, but it keeps failing at symlink creation step.

D:\rust> .\x.ps1 setup --verbose

Error:

...
 walkdir=D:\rust\build\bootstrap\debug\deps\libwalkdir-f2870198f2acf5fd.rlib --extern windows=D:\rust\build\bootstrap\debug\deps\libwindows-c4563d6075a2ef2a.rlib --extern xz2=D:\rust\build\bootstrap\debug\deps\libxz2-62574e69996d0533.rlib -Zallow-features= -Wrust_2018_idioms -Wunused_lifetimes -Dwarnings -L native=C:\Users\Mallur\.cargo\registry\src\index.crates.io-6f17d22bba15001f\windows_x86_64_msvc-0.52.6\lib -L native=D:\rust\build\bootstrap\debug\build\lzma-sys-61433400dfaa550a\out`
    Finished `dev` profile [unoptimized] target(s) in 59.89s
running: D:\rust\build\bootstrap\debug\bootstrap setup --verbose
finding compilers
CC_x86_64-pc-windows-msvc = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe"
CFLAGS_x86_64-pc-windows-msvc = ["-nologo", "-MT", "-Brepro"]
CXX_x86_64-pc-windows-msvc = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX64\\x64\\cl.exe"
CXXFLAGS_x86_64-pc-windows-msvc = ["-nologo", "-MT", "-Brepro"]
thread 'main' panicked at src/lib.rs:468:9:
symlink_dir(&build.config, &build_triple, &host) failed with The file or directory is corrupted and unreadable. (os error 1392) ("symlink_dir(D:\\rust\\build\\host => D:\\rust\\build\\x86_64-pc-windows-msvc) failed")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "D:\rust\x.py", line 50, in <module>
    bootstrap.main()
  File "D:\rust\src\bootstrap\bootstrap.py", line 1191, in main
    bootstrap(args)
  File "D:\rust\src\bootstrap\bootstrap.py", line 1167, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "D:\rust\src\bootstrap\bootstrap.py", line 186, in run
    raise RuntimeError(err)
RuntimeError: failed to run: D:\rust\build\bootstrap\debug\bootstrap.exe setup --verbose

Couldn't find any solutions online. How do I proceed here?

The error "The file or directory is corrupted and unreadable." seems to indicate that there is either corruption to the filesystem on the C: drive or your harddisk itself is defect. I would try looking at the SMART status of the disk to see if it is still healthy. If it is you can try checking the filesystem for corruption using chkdsk or similar. If it the disk is not health, do not run chkdsk (it will likely may things worse). Instead backup everything you care about and either migrate your windows installation to a new disk or do a new installation from scratch on the new disk.

2 Likes

Disk health check was ok, which was expected as this is fairly new disk - bought 1.5 years back.

The issue turned out to be a corruption on filesystem. Copied important to date another drive, and formatted the Disk. I'm able to build the compiler from that drive now.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.