1

When compiling my Rust app in Windows 10, it is linked against ucrtbase.dll; however, this dll does not exist on some editions of Windows Server 2008 R2 Datacenter, making my app impossible to execute.

I tried setting -Ctarget-feature=+crt-static as found here, but it did not do anything; ldd app.exe still shows this dll.

Is there a way of removing the dependency on this dll?

Zezombye
  • 321
  • 4
  • 16

1 Answers1

0

If your Rust app does not depend on C libraries that specifically require the MSVC toolchain, you can build it for the x86_64-pc-windows-gnu (or i686-pc-windows-gnu, to build for 32-bit CPUs) target instead. This target links to DLLs that are available in all Windows versions.

For more information about the different Windows ABIs, you can check out this documentation page.

  • Sadly, even building against x86_64-pc-windows-gnu still links against ucrtbase.dll :( – Zezombye Nov 26 '22 at 17:39
  • That's sad to hear. Have you checked out [`static_vcruntime`](https://users.rust-lang.org/t/static-vcruntime-distribute-windows-msvc-binaries-without-needing-to-deploy-vcruntime-dll/57599)? It doesn't address the problem of getting rid of `ucrtbase.dll`, but its techniques maybe help you find a solution to your problem. – Alejandro González Nov 28 '22 at 11:14