`cargo build` fails with linking error “link.exe failed: exit code: 325595”

一世执手 提交于 2019-12-31 05:19:26

问题


I have a Rust project that compiles okay on Linux, macOS, and Windows 10.

I installed the following individual components on my Windows 7 computer today using the Visual Studio Installer:

  • VC++ 2015.3 v14.00 (v140) toolset for desktop
    • Windows Universal CRT SDK (Dependency)
    • Windows 8.1 SDK (Dependency)

After that, I installed Rust using a fresh rustup-init.exe from the official website.

When I run cargo build on my Rust project on the Windows 7 computer, it fails with the following message:

error: linking with `C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe\` failed: exit code: 325595.

Running C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe all on its own with no arguments on my Windows 10 computer produces some "help" information, but on my Windows 7 computer, I get a window with the error message:

The application was unable to start correctly (0xc000007b).  Click Ok to close the application.

My Google-Fu hasn't turned up any useful information. I've tried:

  • sfc /scannow
  • ensure System32 doesn't have 32-bit DLLs
  • ensure SysWOW64 doesn't have 64-bit DLLs

回答1:


After downloading the latest 64-bit runtime Visual C++ Redistributable for Visual Studio 2017, link.exe works on my Windows 7 computer. I can now compile my Rust project.

I'm surprised that the Visual Studio Installer doesn't ensure that the necessary runtime components are installed for the 2015 toolset.


Update: Stargateur pointed out that the Redistributable can be installed directly from the Visual Studio Installer. It is the Visual C++ 2017 Redistributable Update individual component.



来源:https://stackoverflow.com/questions/50337099/cargo-build-fails-with-linking-error-link-exe-failed-exit-code-325595

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!