Skip to content

error: could not compile std (lib) exit code: 0x80000003 #128498

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wmjb opened this issue Aug 1, 2024 · 14 comments
Open

error: could not compile std (lib) exit code: 0x80000003 #128498

wmjb opened this issue Aug 1, 2024 · 14 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wmjb
Copy link

wmjb commented Aug 1, 2024

steps..

git clone https://github.com/rust-lang/rust.git
cd rust

python x.py setup

python x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc -- --release

output..

Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.73s
Building stage0 library artifacts (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 6.77s
Building compiler artifacts (stage0 -> stage1, x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 5.78s
Creating a sysroot for stage1 compiler (use `rustup toolchain link 'name' build/host/stage1`)
Building stage0 tool lld-wrapper (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 0.58s
Building stage0 tool wasm-component-ld (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 1.58s
Building tool llvm-bitcode-linker (stage0 -> stage1, x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 1.32s
Building stage1 library artifacts (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 3.10s
Building compiler artifacts (stage1 -> stage2, x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 4.17s
Creating a sysroot for stage2 compiler (use `rustup toolchain link 'name' build/host/stage2`)
Building stage1 tool lld-wrapper (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 0.54s
Building stage1 tool wasm-component-ld (x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 1.13s
Building tool llvm-bitcode-linker (stage1 -> stage2, x86_64-pc-windows-msvc)
    Finished `release` profile [optimized] target(s) in 1.05s
Building stage2 library artifacts {alloc, core, panic_abort, panic_unwind, proc_macro, std, sysroot, test, unwind} (x86_64-pc-windows-msvc -> thumbv7a-pc-windows-msvc)
   Compiling std v0.0.0 (D:\rust\library\std)
error: could not compile `std` (lib)

Caused by:
  process didn't exit successfully: `D:\rust\build\bootstrap\debug\rustc D:\rust\build\bootstrap\debug\rustc --crate-name std --edition=2021 library\std\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=119 --crate-type dylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no --warn=unexpected_cfgs --cfg "feature=\"addr2line\"" --cfg "feature=\"backtrace\"" --cfg "feature=\"compiler-builtins-c\"" --cfg "feature=\"miniz_oxide\"" --cfg "feature=\"object\"" --cfg "feature=\"panic_unwind\"" --cfg "feature=\"std_detect_dlsym_getauxval\"" --cfg "feature=\"std_detect_file_io\"" --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values(\"addr2line\", \"backtrace\", \"compiler-builtins-c\", \"compiler-builtins-mangled-names\", \"compiler-builtins-mem\", \"compiler-builtins-no-asm\", \"compiler-builtins-no-f16-f128\", \"llvm-libunwind\", \"miniz_oxide\", \"object\", \"optimize_for_size\", \"panic-unwind\", \"panic_immediate_abort\", \"panic_unwind\", \"profiler\", \"profiler_builtins\", \"std_detect_dlsym_getauxval\", \"std_detect_env_override\", \"std_detect_file_io\", \"system-llvm-libunwind\", \"windows_raw_dylib\"))" --check-cfg cfg(bootstrap) --check-cfg "cfg(target_arch, values(\"xtensa\"))" --check-cfg "cfg(feature, values(any()))" -C metadata=8d8edc62bcc192a7 -C extra-filename=-8d8edc62bcc192a7 --out-dir D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps --target thumbv7a-pc-windows-msvc -L dependency=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps -L dependency=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\release\deps --extern alloc=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\liballoc-64c5af467adecea6.rlib --extern priv:cfg_if=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libcfg_if-39ca9bdb037cfc93.rlib --extern priv:compiler_builtins=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libcompiler_builtins-2dd24f9fb1ee66e8.rlib --extern core=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libcore-1bd16df35471a96e.rlib --extern priv:hashbrown=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libhashbrown-8908b4430318034b.rlib --extern priv:panic_abort=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libpanic_abort-79cdc42c031ef029.rlib --extern priv:panic_unwind=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libpanic_unwind-917a8ede353cd7ab.rlib --extern priv:rustc_demangle=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\librustc_demangle-5d7a0ca342650dd4.rlib --extern priv:std_detect=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libstd_detect-f2cdbbb9f9502900.rlib --extern priv:unwind=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\deps\libunwind-24150c2f5196627c.rlib -Z unstable-options -Csymbol-mangling-version=legacy -Zunstable-options --check-cfg=cfg(feature,values(any())) -Zunstable-options --check-cfg=cfg(bootstrap) -Zmacro-backtrace -Csplit-debuginfo=packed -Ctarget-feature=+crt-static -Cprefer-dynamic -Zinline-mir -Zinline-mir-preserve-debug -Cembed-bitcode=yes -Cforce-frame-pointers=yes "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/nightly/\")" -Z binary-dep-depinfo -L "native=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\atlmfc\lib\arm" -L native=D:\rust\build\x86_64-pc-windows-msvc\stage2-std\thumbv7a-pc-windows-msvc\release\build\compiler_builtins-1d52e78cbce2107d\out --cfg backtrace_in_libstd --check-cfg cfg(netbsd10) --check-cfg cfg(restricted_std) --check-cfg cfg(backtrace_in_libstd) --check-cfg cfg(reliable_f16) --check-cfg cfg(reliable_f128)` (exit code: 0x80000003)
Build completed unsuccessfully in 0:01:48
@wmjb wmjb added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 1, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 1, 2024
@wmjb wmjb changed the title error: could not compile std (lib) exit code: 0x8000000 error: could not compile std (lib) exit code: 0x80000003 Aug 1, 2024
@bjorn3
Copy link
Member

bjorn3 commented Aug 1, 2024

That exit code is EXCEPTION_BREAKPOINT. In other words a breakpoint was hit. There shouldn't be any breakpoints being hit unless you are running a debugger. Can you attach a debugger and try to get a backtrace?

@wmjb
Copy link
Author

wmjb commented Aug 1, 2024

That exit code is EXCEPTION_BREAKPOINT. In other words a breakpoint was hit. There shouldn't be any breakpoints being hit unless you are running a debugger. Can you attach a debugger and try to get a backtrace?

not sure how i would go about attaching a debugger to this , ill investigate. thanks.

@wmjb
Copy link
Author

wmjb commented Aug 1, 2024

also tying to compile the thumbv7a-uwp-windows-msvc results in

`error: unused import: `WinError`
 --> library\std\src\sys\pal\windows\os.rs:8:24
  |
8 | use super::api::{self, WinError};
  |                        ^^^^^^^^
  |
  = note: `-D unused-imports` implied by `-D warnings`
  = help: to override `-D warnings` add `#[allow(unused_imports)]`

error[E0133]: call to unsafe function `sys::pal::windows::stack_overflow_uwp::reserve_stack` is unsafe and requires unsafe block
  --> library\std\src\sys\pal\windows\thread.rs:51:13
   |
51 |             stack_overflow::reserve_stack();
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
   |
   = note: for more information, see issue #71668 <https://github.com/rust-lang/rust/issues/71668>
   = note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
  --> library\std\src\sys\pal\windows\thread.rs:49:9
   |
49 |         unsafe extern "system" fn thread_start(main: *mut c_void) -> u32 {
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: the lint level is defined here
  --> library\std\src\sys\pal\windows\mod.rs:2:11
   |
2  | #![forbid(unsafe_op_in_unsafe_fn)]
   |           ^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0133`.
error: could not compile `std` (lib) due to 2 previous errors
Build completed unsuccessfully in 0:03:26`

@wmjb
Copy link
Author

wmjb commented Aug 2, 2024

That exit code is EXCEPTION_BREAKPOINT. In other words a breakpoint was hit. There shouldn't be any breakpoints being hit unless you are running a debugger. Can you attach a debugger and try to get a backtrace?

using windbg and attaching to rustc as it's compiling std


************* Preparing the environment for Debugger Extensions Gallery repositories **************
   ExtensionRepository : Implicit
   UseExperimentalFeatureForNugetShare : true
   AllowNugetExeUpdate : true
   NonInteractiveNuget : true
   AllowNugetMSCredentialProviderInstall : true
   AllowParallelInitializationOfLocalRepositories : true

   EnableRedirectToV8JsProvider : false

   -- Configuring repositories
      ----> Repository : LocalInstalled, Enabled: true
      ----> Repository : UserExtensions, Enabled: true

>>>>>>>>>>>>> Preparing the environment for Debugger Extensions Gallery repositories completed, duration 0.000 seconds

************* Waiting for Debugger Extensions Gallery to Initialize **************

>>>>>>>>>>>>> Waiting for Debugger Extensions Gallery to Initialize completed, duration 0.031 seconds
   ----> Repository : UserExtensions, Enabled: true, Packages count: 0
   ----> Repository : LocalInstalled, Enabled: true, Packages count: 41

Microsoft (R) Windows Debugger Version 10.0.27553.1004 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

*** wait with pending attach

************* Path validation summary **************
Response                         Time (ms)     Location
Deferred                                       srv*
Symbol search path is: srv*
Executable search path is: 
ModLoad: 00007ff6`37190000 00007ff6`371b1000   D:\newrust\rust\build\x86_64-pc-windows-msvc\stage2\bin\rustc.exe
ModLoad: 00007ffa`5d1a0000 00007ffa`5d3a9000   C:\WINDOWS\SYSTEM32\ntdll.dll
ModLoad: 00007ffa`5b4a0000 00007ffa`5b55d000   C:\WINDOWS\System32\KERNEL32.DLL
ModLoad: 00007ffa`5a8e0000 00007ffa`5ac64000   C:\WINDOWS\System32\KERNELBASE.dll
ModLoad: 00007ffa`06eb0000 00007ffa`0778a000   D:\newrust\rust\build\x86_64-pc-windows-msvc\stage2\bin\std-59ca7ddc90456d1c.dll
ModLoad: 00007ffa`5b430000 00007ffa`5b49f000   C:\WINDOWS\System32\WS2_32.dll
ModLoad: 00007ffa`5d030000 00007ffa`5d151000   C:\WINDOWS\System32\RPCRT4.dll
ModLoad: 00007ffa`59d30000 00007ffa`59d5c000   C:\WINDOWS\SYSTEM32\USERENV.dll
ModLoad: 00007ffa`5ac70000 00007ffa`5ad81000   C:\WINDOWS\System32\ucrtbase.dll
ModLoad: 00007ffa`5ae00000 00007ffa`5ae7f000   C:\WINDOWS\System32\bcryptprimitives.dll
ModLoad: 00007ff9`d00a0000 00007ff9`d8a47000   D:\newrust\rust\build\x86_64-pc-windows-msvc\stage2\bin\rustc_driver-efeae7c694ee3858.dll
ModLoad: 00007ffa`5b560000 00007ffa`5b636000   C:\WINDOWS\System32\oleaut32.dll
ModLoad: 00007ffa`5a630000 00007ffa`5a6cd000   C:\WINDOWS\System32\msvcp_win.dll
ModLoad: 00007ffa`5c920000 00007ffa`5cc96000   C:\WINDOWS\System32\combase.dll
ModLoad: 00007ffa`5aff0000 00007ffa`5b18a000   C:\WINDOWS\System32\ole32.dll
ModLoad: 00007ffa`5cca0000 00007ffa`5ccca000   C:\WINDOWS\System32\GDI32.dll
ModLoad: 00007ffa`5a7f0000 00007ffa`5a816000   C:\WINDOWS\System32\win32u.dll
ModLoad: 00007ffa`5a6d0000 00007ffa`5a7ee000   C:\WINDOWS\System32\gdi32full.dll
ModLoad: 00007ffa`5b280000 00007ffa`5b42d000   C:\WINDOWS\System32\USER32.dll
ModLoad: 00007ffa`5c0d0000 00007ffa`5c895000   C:\WINDOWS\System32\SHELL32.dll
ModLoad: 00007ffa`5b6d0000 00007ffa`5b77e000   C:\WINDOWS\System32\ADVAPI32.dll
ModLoad: 00007ffa`5ce40000 00007ffa`5cee3000   C:\WINDOWS\System32\msvcrt.dll
ModLoad: 00007ffa`5cda0000 00007ffa`5ce3e000   C:\WINDOWS\System32\sechost.dll
ModLoad: 00007ffa`5a000000 00007ffa`5a027000   C:\WINDOWS\SYSTEM32\bcrypt.dll
ModLoad: 00007ffa`59ea0000 00007ffa`59eac000   C:\WINDOWS\SYSTEM32\CRYPTBASE.DLL
ModLoad: 00007ffa`5cfe0000 00007ffa`5d011000   C:\WINDOWS\System32\IMM32.DLL
(2b90.35f0): Break instruction exception - code 80000003 (first chance)
ntdll!DbgBreakPoint:
00007ffa`5d247920 cc              int     3
0:006> g
ModLoad: 00007ffa`59790000 00007ffa`597a8000   C:\WINDOWS\SYSTEM32\kernel.appcore.dll
ModLoad: 00007ffa`5ccf0000 00007ffa`5cd9f000   C:\WINDOWS\System32\clbcatq.dll
ModLoad: 00007ffa`05800000 00007ffa`058f6000   C:\ProgramData\Microsoft\VisualStudio\Setup\x64\Microsoft.VisualStudio.Setup.Configuration.Native.dll
ModLoad: 00007ffa`5bf40000 00007ffa`5bf9d000   C:\WINDOWS\System32\SHLWAPI.dll
(2b90.3acc): Break instruction exception - code 80000003 (first chance)
*** WARNING: Unable to verify checksum for D:\newrust\rust\build\x86_64-pc-windows-msvc\stage2\bin\rustc_driver-efeae7c694ee3858.dll
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1cfe:
00007ff9`d3513bae cc              int     3
0:005> g
(2b90.3acc): Break instruction exception - code 80000003 (first chance)
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1cff:
00007ff9`d3513baf cc              int     3
0:005> g
(2b90.3acc): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1d16:
00007ff9`d3513bc6 8b01            mov     eax,dword ptr [rcx] ds:00000000`fffffffc=????????
0:005> g
(2b90.3acc): Access violation - code c0000005 (!!! second chance !!!)
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1d16:
00007ff9`d3513bc6 8b01            mov     eax,dword ptr [rcx] ds:00000000`fffffffc=????????
0:005> g
(2b90.3acc): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1d16:
00007ff9`d3513bc6 8b01            mov     eax,dword ptr [rcx] ds:00000000`fffffffc=????????
0:005> g
(2b90.3acc): Access violation - code c0000005 (!!! second chance !!!)
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1d16:
00007ff9`d3513bc6 8b01            mov     eax,dword ptr [rcx] ds:00000000`fffffffc=????????
0:005> g
(2b90.3acc): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
rustc_driver_efeae7c694ee3858!llvm::AllocatorBase<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator,4096,4096,128> >::Allocate<char>+0x1d16:
00007ff9`d3513bc6 8b01            mov     eax,dword ptr [rcx] ds:00000000`fffffffc=????????

@bjorn3
Copy link
Member

bjorn3 commented Aug 2, 2024

This seems to be a crash inside LLVM's memory allocator.

@bjorn3 bjorn3 added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Aug 2, 2024
@wmjb
Copy link
Author

wmjb commented Aug 2, 2024

This seems to be a crash inside LLVM's memory allocator.

im going to give it a try on another device with a fresh os install to see if it's something with the system.

@mati865
Copy link
Member

mati865 commented Aug 2, 2024

Is it a system with Intel 13 or 14 gen CPU by any chance?

@wmjb
Copy link
Author

wmjb commented Aug 3, 2024

Is it a system with Intel 13 or 14 gen CPU by any chance?

fist attempt was using a intel core i5-4590T
second attempt was using a dual intel xeon x5650

both resulted in exactly the same error.

@petrochenkov
Copy link
Contributor

petrochenkov commented Aug 3, 2024

I started encountering very similar issues after the recent LLVM update.
My case reported in #128275 (comment) and below.

@wmjb
Copy link
Author

wmjb commented Aug 4, 2024

managed to compile properly using a previous version , tried many, 1.74.1 worked.

build steps were

install windows 10 and visual studio 2022 community edition, dekstop C++ workload and arm toolchains and latest windows sdk
install git for windows and python 3.12

in windows powershell as administrator (not using vcvars or vs dev cmd prompt)

git clone --depth=1 https://github.com/rust-lang/rust.git -b 1.74.1 rust-1.74.1
cd rust-1.74.1
git submodule init
git submodule update
python x.py setup (chose option e in setup, everything else as default)
python x.py build --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc

@wmjb
Copy link
Author

wmjb commented Aug 4, 2024

cargo.toml.txt
cargo.toml included in case it's of any use

@wmjb
Copy link
Author

wmjb commented Aug 4, 2024

i'm a bit lost as to the next steps, do i run python x.py install to make use of the thumbv7a-pc-windows-msvc` target?

--edit partly figured it out python x.py install --host x86_64-pc-windows-msvc --build x86_64-pc-windows-msvc --target thumbv7a-pc-windows-msvc after setting up a sh console in path as the build system thinks it's running on linux

@petrochenkov petrochenkov added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Aug 4, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 20, 2024
@bdbai
Copy link
Contributor

bdbai commented Dec 20, 2024

I didn't notice this issue before filing #134565 😅 they might be related.
Also see #120921 .

@bdbai
Copy link
Contributor

bdbai commented Apr 16, 2025

I tried compiling a staticlib for thumbv7a using nightly-2025-04-16 on a 14th gen Intel CPU and it was working. There might be some ongoing improvements in LLVM I suppose?

@wmjb Would you be able to double confirm that it also works in your setup?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

7 participants