Skip to content

bootstrap: refactor mingw dist and fix gnullvm #144659

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mati865
Copy link
Member

@mati865 mati865 commented Jul 29, 2025

Fixes #144533

The first two commits are NFC and only clean up the code, paving the way for the third commit. That said, I think they are worthwhile even without that fix - reusing the same function for two different outcomes was confusing.

The third commit is the fix for #144533, but due to the cross-compilation dance it requires a workaround to find the DLL since that logic really was meant only for Windows builders. That workaround is short-lived and will be removed as soon as gnullvm bootstraps itself.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 29, 2025
@mati865
Copy link
Member Author

mati865 commented Jul 29, 2025

@bors try jobs=dist-aarch64-windows-gnullvm,dist-x86_64-windows-gnullvm,dist-i686-windows-gnu,dist-x86_64-windows-gnu

Also including regular windows-gnu to double-check there is no regression there.

@rust-bors
Copy link

rust-bors bot commented Jul 29, 2025

⌛ Trying commit cc7a7a5 with merge 7fe80ed

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Jul 29, 2025
bootstrap: extract cc query into a new function

try-job: dist-aarch64-windows-gnullvm
try-job: dist-x86_64-windows-gnullvm
try-job: dist-i686-windows-gnu
try-job: dist-x86_64-windows-gnu
@rust-bors
Copy link

rust-bors bot commented Jul 29, 2025

💔 Test failed (CI). Failed job:

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@mati865
Copy link
Member Author

mati865 commented Jul 30, 2025

@bors try jobs=dist-aarch64-windows-gnullvm,dist-x86_64-windows-gnullvm,dist-i686-mingw,dist-x86_64-mingw

@rust-bors
Copy link

rust-bors bot commented Jul 30, 2025

⌛ Trying commit cc7a7a5 with merge 77b2b72

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Jul 30, 2025
bootstrap: extract cc query into a new function

try-job: dist-aarch64-windows-gnullvm
try-job: dist-x86_64-windows-gnullvm
try-job: dist-i686-mingw
try-job: dist-x86_64-mingw
@rust-bors
Copy link

rust-bors bot commented Jul 30, 2025

☀️ Try build successful (CI)
Build commit: 77b2b72 (77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f, parent: ba7e63b63871a429533c189adbfb1d9a6337e000)

@mati865
Copy link
Member Author

mati865 commented Jul 30, 2025

Tested the changes against parent commit using the following commands on Linux:

  1. preparation (removed output to reduce clutter):
rustup-toolchain-install-master -n ba7e63b-amd64-gnu -i x86_64-pc-windows-gnu ba7e63b63871a429533c189adbfb1d9a6337e000
rustup-toolchain-install-master -n 77b2b72-amd64-gnu -i x86_64-pc-windows-gnu 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f

rustup-toolchain-install-master -n ba7e63b-amd64-gnu-with-mingw -i x86_64-pc-windows-gnu ba7e63b63871a429533c189adbfb1d9a6337e000 -c rust-mingw
rustup-toolchain-install-master -n 77b2b72-amd64-gnu-with-mingw -i x86_64-pc-windows-gnu 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f -c rust-mingw

rustup-toolchain-install-master -n ba7e63b-i686-gnu -i i686-pc-windows-gnu ba7e63b63871a429533c189adbfb1d9a6337e000
rustup-toolchain-install-master -n 77b2b72-i686-gnu -i i686-pc-windows-gnu 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f

rustup-toolchain-install-master -n ba7e63b-i686-gnu-with-mingw -i i686-pc-windows-gnu ba7e63b63871a429533c189adbfb1d9a6337e000 -c rust-mingw
rustup-toolchain-install-master -n 77b2b72-i686-gnu-with-mingw -i i686-pc-windows-gnu 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f -c rust-mingw

rustup-toolchain-install-master -n ba7e63b-amd64-gnullvm -i x86_64-pc-windows-gnullvm ba7e63b63871a429533c189adbfb1d9a6337e000
rustup-toolchain-install-master -n 77b2b72-amd64-gnullvm -i x86_64-pc-windows-gnullvm 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f

rustup-toolchain-install-master -n ba7e63b-aarch64-gnullvm -i aarch64-pc-windows-gnullvm ba7e63b63871a429533c189adbfb1d9a6337e000
rustup-toolchain-install-master -n 77b2b72-aarch64-gnullvm -i aarch64-pc-windows-gnullvm 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f
  1. diffing (Bash syntax via Brush):
comm -3 \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/77b2b72-amd64-gnu | sort) \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/ba7e63b-amd64-gnu | sort)
   
comm -3 \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/77b2b72-amd64-gnu-with-mingw | sort) \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/ba7e63b-amd64-gnu-with-mingw | sort)
   
comm -3 \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/77b2b72-i686-gnu | sort) \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/ba7e63b-i686-gnu | sort)
   
comm -3 \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/77b2b72-i686-gnu-with-mingw | sort) \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/ba7e63b-i686-gnu-with-mingw | sort)
   
comm -3 \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/77b2b72-amd64-gnullvm | sort) \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/ba7e63b-amd64-gnullvm | sort)
   
comm -3 \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/77b2b72-aarch64-gnullvm | sort) \
   <(fd . -t f --relative-path --base-directory ~/.rustup/toolchains/ba7e63b-aarch64-gnullvm | sort)
bin/libunwind.dll
lib/rustlib/x86_64-pc-windows-gnullvm/bin/libunwind.dll
share/doc/COPYING3
share/doc/COPYING.RUNTIME
share/doc/README.txt
bin/libunwind.dll
lib/rustlib/aarch64-pc-windows-gnullvm/bin/libunwind.dll
share/doc/COPYING3
share/doc/COPYING.RUNTIME
share/doc/README.txt
  1. quick confirmation the locations are correct:
❯ fd libunwind.dll /home/mateusz/.rustup/toolchains
/home/mateusz/.rustup/toolchains/77b2b72-aarch64-gnullvm/bin/libunwind.dll
/home/mateusz/.rustup/toolchains/77b2b72-aarch64-gnullvm/lib/rustlib/aarch64-pc-windows-gnullvm/bin/libunwind.dll
/home/mateusz/.rustup/toolchains/77b2b72-amd64-gnullvm/bin/libunwind.dll
/home/mateusz/.rustup/toolchains/77b2b72-amd64-gnullvm/lib/rustlib/x86_64-pc-windows-gnullvm/bin/libunwind.dll
  1. sanity check by running amd64 compiler (my only AArch64 HW is an old RPi, so I didn't bother running it):
❯ wine /home/mateusz/.rustup/toolchains/77b2b72-amd64-gnullvm/bin/rustc.exe -vV
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
rustc 1.90.0-nightly (77b2b72bf 2025-07-30)
binary: rustc
commit-hash: 77b2b72bf88b5e4f2344d9364b0e76c1595e3c1f
commit-date: 2025-07-30
host: x86_64-pc-windows-gnullvm
release: 1.90.0-nightly
0024:fixme:file:NtFsControlFile FSCTL_GET_REPARSE_POINT semi-stub
LLVM version: 20.1.8

❯ wine /home/mateusz/.rustup/toolchains/ba7e63b-amd64-gnullvm/bin/rustc.exe -vV
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
00b8:fixme:wineusb:query_id Unhandled ID query type 0x5.
0024:err:module:import_dll Library libunwind.dll (which is needed by L"Z:\\home\\mateusz\\.rustup\\toolchains\\ba7e63b-amd64-gnullvm\\bin\\rustc_driver-b7009de26466cbbd.dll") not found
0024:err:module:import_dll Library rustc_driver-b7009de26466cbbd.dll (which is needed by L"Z:\\home\\mateusz\\.rustup\\toolchains\\ba7e63b-amd64-gnullvm\\bin\\rustc.exe") not found
0024:err:module:loader_init Importing dlls for L"Z:\\home\\mateusz\\.rustup\\toolchains\\ba7e63b-amd64-gnullvm\\bin\\rustc.exe" failed, status c0000135

I hope this clearly (albeit in a lengthy way) shows no regression for *windows-gnu toolchains and the fix for windows-gnullvm toolchains.

@mati865 mati865 force-pushed the gnullvm-vendor-libunwind branch from cc7a7a5 to e22a6ce Compare July 30, 2025 21:25
@mati865 mati865 marked this pull request as ready for review July 30, 2025 21:25
@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2025

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 30, 2025
@mati865
Copy link
Member Author

mati865 commented Jul 30, 2025

Beta was branched already last week, right?

@mati865 mati865 changed the title bootstrap: extract cc query into a new function bootstrap: refactor mingw dist and fix gnullvm Jul 31, 2025
@mati865
Copy link
Member Author

mati865 commented Aug 2, 2025

Judging by their profile albertlarsan68 seems to be away right now, so I will take a liberty to reroll because the release is near and this might get backported for the next beta.

r? rust-lang/bootstrap

@rustbot rustbot assigned Kobzol and unassigned albertlarsan68 Aug 2, 2025
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first commits are a nice cleanup, thanks.

}
// FIXME(#144565): Remove this whole `let ...`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the FIXME, it also refers to some other PR?

rustc_dlls.push("libgcc_s_dw2-1.dll");
} else {
rustc_dlls.push("libgcc_s_seh-1.dll");
}
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would spell gnullvm explicitly here, to make it more obvious which targets need libunwind.dll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

{aarch64,x86_64}-pc-windows-gnullvm host tools are missing libunwind.dll
5 participants