Skip to content
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

fix: always cross-compile to windows via xwin #1635

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Conversation

mistydemeo
Copy link
Contributor

@mistydemeo mistydemeo commented Dec 12, 2024

Cross-compiling from Windows to Windows using zigbuild is broken; we're getting zig cc errors we can't fix. We should always use xwin instead. If we detect Windows cross-compilation, we should always pick an xwin container image, specifically the same one we recommend our users to use.

Sample broken build: https://github.com/mistydemeo/cargodisttest/actions/runs/12305247980/job/34344574841#step:9:46

error: linking with `C:\Users\runneradmin\AppData\Local\cargo-zigbuild\0.19.5\zigcc-aarch64-pc-windows-msvc-b7f1.bat` failed: exit code: 1
  |
  = note: "cmd" "/c" "C:\\Users\\runneradmin\\AppData\\Local\\cargo-zigbuild\\0.19.5\\zigcc-aarch64-pc-windows-msvc-b7f1.bat" "/NOLOGO" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustct8HDn7\\symbols.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.1h5gupdrrppkjf4vrl70p0db0.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.alloc-f3305208c0a8d188.alloc.9d72608bbf3aa790-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstream-f48b9088b59268cc.anstream.5c9dc568e8bbe080-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstream-f48b9088b59268cc.anstream.5c9dc568e8bbe080-cgu.1.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstream-f48b9088b59268cc.anstream.5c9dc568e8bbe080-cgu.2.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstream-f48b9088b59268cc.anstream.5c9dc568e8bbe080-cgu.3.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstyle-c584a004cd453c6c.anstyle.508eb198312404e6-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstyle_parse-02ed76b8659dbd6a.anstyle_parse.976ae02760d0d1d0-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstyle_query-e9f7ee9a670e6fa7.anstyle_query.8e13d95f64424326-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.anstyle_wincon-936db600d6d8024a.anstyle_wincon.9f3457c9f2c2e42b-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.axolotlsay.243b6d501ba7a906-cgu.0.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.axolotlsay.243b6d501ba7a906-cgu.1.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.axolotlsay.243b6d501ba7a906-cgu.2.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.axolotlsay.243b6d501ba7a906-cgu.3.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.axolotlsay.243b6d501ba7a906-cgu.4.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.axolotlsay.243b6d501ba7a906-cgu.5.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.cfg_if-ea17b6dd1cfbc78f.cfg_if.59367ebc9beca28a-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap-a27b5cadb22f2e10.clap.a46a58d7f8993f47-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.00.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.01.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.02.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.03.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.04.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.05.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.06.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.07.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.08.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.09.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.10.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.11.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.12.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.13.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.14.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_builder-403b847b16f344f5.clap_builder.6e9e7c289d2ec1a5-cgu.15.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.clap_lex-f6a8f4cdbb3e71a9.clap_lex.547df4e3fc799013-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.colorchoice-255038f3b56811ef.colorchoice.fa39635825a2270d-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.core-a49f0a156949d8e3.core.60e9e0edcf389d55-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.hashbrown-ba79989b9f59e7e1.hashbrown.823879cec6cb714-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.is_terminal-cbf80d1117c5ad73.is_terminal.6afa759f38b8a399-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.is_terminal-cbf80d1117c5ad73.is_terminal.6afa759f38b8a399-cgu.1.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.memchr-e2c48759cce57f2c.memchr.573b41eaa8aba341-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.once_cell-f9426656b2703090.once_cell.4cd0a89a2fb77288-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.panic_unwind-e96136bc9998b9ae.panic_unwind.8d86954898cb5e7b-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.rustc_demangle-e6822bf7eaa1af1b.rustc_demangle.fb21227277575bfd-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.rustc_std_workspace_alloc-2c3a97c56c1dbabf.rustc_std_workspace_alloc.f8f1f6dabf9c5738-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.rustc_std_workspace_core-02b2cc54c9913de7.rustc_std_workspace_core.7c9f71f391ae781c-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.std-00b5110a57096f03.std.6f9ad703caecc659-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.std_detect-49106a386853e71d.std_detect.8c38acd94fd72d39-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.strsim-eae2b20bd4c7b79f.strsim.7528e7842d35528e-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.strsim-eae2b20bd4c7b79f.strsim.7528e7842d35528e-cgu.1.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.strsim-eae2b20bd4c7b79f.strsim.7528e7842d35528e-cgu.2.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.strsim-eae2b20bd4c7b79f.strsim.7528e7842d35528e-cgu.3.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.strsim-eae2b20bd4c7b79f.strsim.7528e7842d35528e-cgu.4.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.unicode_width-dd76f9b498456afb.unicode_width.6107d3a083a1ccf-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.unwind-8dafc0712eb7180c.unwind.bf4b909f1f1315aa-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.utf8parse-9d04b6e50c3deba2.utf8parse.b16f148aa08ed173-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.windows_sys-22da62b9efe05468.windows_sys.63642486479bad0d-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.windows_targets-0f39f613c0655b09.windows_targets.f113ba56212bb1fd-cgu.0.rcgu.o.rcgu.o" "D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.windows_targets-73348042ef1b58d5.windows_targets.e37e5c739f667b78-cgu.0.rcgu.o.rcgu.o" "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustct8HDn7\\libstd-00b5110a57096f03.rlib" "C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\aarch64-pc-windows-msvc\\lib\\libcompiler_builtins-6b99e5608caed833.rlib" "C:\\Users\\runneradmin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_aarch64_msvc-0.48.0\\lib\\windows.0.48.0.lib" "kernel32.lib" "kernel32.lib" "advapi32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:libcmt" "/NXCOMPAT" "/LIBPATH:C:\\Users\\runneradmin\\.cargo\\registry\\src\\index.crates.io-6f17d22bba15001f\\windows_aarch64_msvc-0.48.0\\lib" "/OUT:D:\\a\\cargodisttest\\cargodisttest\\target\\aarch64-pc-windows-msvc\\dist\\deps\\axolotlsay.exe" "/OPT:REF,ICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:C:\\Users\\runneradmin\\.rustup\\toolchains\\stable-x86_64-pc-windows-msvc\\lib\\rustlib\\etc\\libstd.natvis"
  = note: error(link): unable to spawn C:\hostedtoolcache\windows\Python\3.7.9\x64\Lib\site-packages\ziglang\zig.exe: InvalidWtf8
          error: UnableToSpawnSelf
          ␍
          D:\a\cargodisttest\cargodisttest>"C:\hostedtoolcache\windows\Python\3.7.9\x64\Scripts\cargo-zigbuild.exe" zig cc -- -g -target aarch64-windows-msvc @C:\Users\RUNNER~1\AppData\Local\Temp\rustct8HDn7\linker-arguments ␍

From searching online, this appears to be a known issue with windows-to-windows zigbuild builds.

Fixes #1633.

Copy link
Member

@ashleygwilliams ashleygwilliams left a comment

Choose a reason for hiding this comment

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

i think this looks good and making more of the dist logic target aware seems super positive!

cargo-dist/src/backend/ci/github.rs Outdated Show resolved Hide resolved
@mistydemeo mistydemeo force-pushed the windows-xwin-default branch 2 times, most recently from 714aa19 to b3a77f2 Compare December 12, 2024 23:13
Cross-compiling from Windows to Windows using zigbuild is broken; we're
getting `zig cc` errors we can't fix. We should always use xwin instead.
If we detect Windows cross-compilation, we should always pick an xwin
container image, specifically the same one we recommend our users to use.
@mistydemeo mistydemeo merged commit 08a2780 into main Dec 12, 2024
18 checks passed
@mistydemeo mistydemeo deleted the windows-xwin-default branch December 12, 2024 23:27
@mistydemeo mistydemeo mentioned this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken ci for aarch64 windows build
2 participants