runner-images icon indicating copy to clipboard operation
runner-images copied to clipboard

Latest windows-server 2022/2025 pre-release image breaks Rust compilation

Open thomaseizinger opened this issue 6 months ago • 10 comments

Description

Building a Rust program fails with:

linking with `link.exe` failed: exit code: 0xc0000409

This consistently reproduces for me when our GUI application is being built on the new Windows runners.

Platforms affected

  • [ ] Azure DevOps
  • [x] GitHub Actions - Standard Runners
  • [ ] GitHub Actions - Larger Runners

Runner images affected

  • [ ] Ubuntu 22.04
  • [ ] Ubuntu 24.04
  • [ ] macOS 13
  • [ ] macOS 13 Arm64
  • [ ] macOS 14
  • [ ] macOS 14 Arm64
  • [ ] macOS 15
  • [ ] macOS 15 Arm64
  • [ ] Windows Server 2019
  • [x] Windows Server 2022
  • [x] Windows Server 2025

Image version and build link

Windows Server 2022 (20250609) Image Update (https://github.com/actions/runner-images/releases/tag/win22%2F20250617.1)

https://github.com/firezone/firezone/actions/runs/15777748095/job/44475944088?pr=9590

Is it regression?

https://github.com/firezone/firezone/actions/runs/15765079094/job/44440022609

Expected behavior

To be able to compile and link Rust projects on the Windows runner.

Actual behavior

The linking step fails.

Repro steps

Compile and link a Rust project on the pre-release runner image.

thomaseizinger avatar Jun 20 '25 11:06 thomaseizinger

Hi @thomaseizinger, Thank you for bringing this issue to our attention. We will look into this issue and will update you after investigating.

hemanthmanga avatar Jun 20 '25 12:06 hemanthmanga

This is affecting windows-2025 now as well: https://github.com/firezone/firezone/actions/runs/15789902409/job/44513762369

thomaseizinger avatar Jun 21 '25 07:06 thomaseizinger

Interestingly, this only appears to affect one particular workflow of ours. Other Windows workflows where we build Rust code work fine.

thomaseizinger avatar Jun 22 '25 22:06 thomaseizinger

@thomaseizinger We have been following your repository and noticed that the job which previously failed on Windows Server 2022 is now passing, as seen in the GitHub Actions workflow below. Can you please confirm us if the issue is resolved. Thanks.

https://github.com/firezone/firezone/actions/runs/15821315684/job/44591093421

RaviAkshintala avatar Jun 23 '25 11:06 RaviAkshintala

This is not the job that is failing. The job that is failing is: https://github.com/firezone/firezone/actions/runs/15816630435/job/44576867194

It appears to be a regression in the Microsoft compiler shipped with the new Visual Studio version that has been installed: https://github.com/rust-lang/rust/issues/141626

thomaseizinger avatar Jun 23 '25 14:06 thomaseizinger

We seem to be affected by this too, over at https://github.com/NLnetLabs/domain/actions/runs/15872079664/job/44750833965?pr=491.

bal-e avatar Jun 25 '25 09:06 bal-e

As a workaround, we are now using lld as suggested in https://github.com/rust-lang/rust/issues/141626#issuecomment-2919988483.

No issues so far but we still need to do further testing on the produced binaries.

thomaseizinger avatar Jun 25 '25 09:06 thomaseizinger

@thomaseizinger, I can confirm that adding the linked .cargo/config.toml file fixes things for us. It might be a bit faster too, not sure.

bal-e avatar Jun 25 '25 09:06 bal-e

Could this flag be set in the runner, so not every project has to experience a failure, search for the solution, then set the flag, then unset it later when MSVC is fixed?

robertbastian avatar Jun 26 '25 16:06 robertbastian

Could this flag be set in the runner, so not every project has to experience a failure, search for the solution, then set the flag, then unset it later when MSVC is fixed?

I don't think this would be a good solution. But it may become the default from Rust's perspective in the future: https://github.com/rust-lang/rust/issues/71520

thomaseizinger avatar Jun 26 '25 21:06 thomaseizinger

@thomaseizinger I hope your issue got resolved after adding the linker = "rust-lld". Could you please confirm on this.Thank you.

RaviAkshintala avatar Jul 08 '25 12:07 RaviAkshintala

@thomaseizinger I hope your issue got resolved after adding the linker = "rust-lld". Could you please confirm on this.Thank you.

Well, it is a workaround. The default linker shipped on the Windows images is stilly buggy and I wouldn't be surprised if C/C++ code is also affected by this. So strictly speaking, the issue is not resolved

Have you informed Microsoft that the linker in this VS version is buggy?

thomaseizinger avatar Jul 08 '25 12:07 thomaseizinger

@thomaseizinger The new version of Visual Studio has been released. Please sync the main branch and try to run the build and confirm. Thanks.

RaviAkshintala avatar Jul 14 '25 09:07 RaviAkshintala

I am not sure what you mean by "syncing the main branch". I tried running a build of our software with the standard linker that comes with the latest Windows runner image but it still fails: https://github.com/firezone/firezone/actions/runs/16317127782/job/46085637870

thomaseizinger avatar Jul 16 '25 10:07 thomaseizinger

@thomaseizinger Thanks for the confirmation. Could you please try with the runner windows-2025 or windows-2022 Instead of xlarge and confirm.

RaviAkshintala avatar Jul 16 '25 12:07 RaviAkshintala

The above run uses the latest windows-2025 image: https://github.com/actions/runner-images/releases/tag/win25%2F20250708.1

thomaseizinger avatar Jul 16 '25 13:07 thomaseizinger

@thomaseizinger Could you please provide a smaller, simpler workflow that reproduces the issue.Thanks.

RaviAkshintala avatar Jul 23 '25 02:07 RaviAkshintala

@thomaseizinger Could you please provide a smaller, simpler workflow that reproduces the issue.Thanks.

I don't unfortunately know exactly, what causes the problem. There are several other issues linked to this one already though so perhaps some of those applications are simpler to build than ours.

thomaseizinger avatar Jul 23 '25 07:07 thomaseizinger

@thomaseizinger We have tested with one of the customer's repositories, and they are also experiencing the same link.exe issue. Please find the attached reference logs for both cases — with linker = "rust-lld and without linker = "rust-lld Both builds completed successfully.

And also go through the discussion on the Microsoft developer community for this issue. Thanks.

RaviAkshintala avatar Jul 23 '25 10:07 RaviAkshintala

For us, it doesn't really matter which linker we use. rust-lld works fine for us so we are likely going to stick with it.

Reading the issue on the Microsoft developer community forum, it seems there is a solution to also change the symbol mangling format.

I am not sure what the path forward for you guys is then here. It seems MS is unable to provide a proper fix right now that does not involve changes in the source repo (either using rust-lld or changing compiler flags). So I guess this could be closed as unable to fix?

thomaseizinger avatar Jul 23 '25 11:07 thomaseizinger

@thomaseizinger The root cause appears to be upstream, and it needs to be addressed there.Please refer to the following issues for further updates and tracking:Rust issue #141626 and Visual Studio Developer Community issue As this is an upstream issue, we are closing this issue. Thank you.

RaviAkshintala avatar Jul 23 '25 11:07 RaviAkshintala