在Windows上使用mingw_64编译Rust时无法加载代码生成后端

时间:2019-06-06 08:07:05

标签: windows rust

我正在使用mingw_64和GCC在Windows上编译Rust。我收到以下错误:

  

错误:无法加载codegen后端“ E:\ rust_git \ rust \ build \ x86_64-pc-windows-gnu \ stage1 \ lib \ rustlib \ x86_64-pc-windows-gnu \ codegen-backends \ rustc_codegen_llvm-llvm .dll“:”找不到指定的过程。(操作系统错误127)“

How do I fix the error "couldn't load codegen backend" on macOS?不同,文件rustc_codegen_llvm-llvm.dll确实位于正确的目录中。

1 个答案:

答案 0 :(得分:0)

找到了原因,最新的mingw gcc 9.1.0导致某些dll丢失问题。 (尽管,编译锈源是可以的)。

如果您使用的是旧版本的msys2,它将为您工作:

pacman -R  mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake
pacman -R  mingw-w64-x86_64-gcc-libs  

pacman -U /var/cache/pacman/pkg/mingw-w64-x86_64-gcc-libs-8.3.0-2-any.pkg.tar.xz
pacman -U /var/cache/pacman/pkg/mingw-w64-x86_64-gcc-8.3.0-2-any.pkg.tar.xz
pacman -U /var/cache/pacman/pkg/mingw-w64-x86_64-cmake-3.14.4-1-any.pkg.tar.xz

./x.py install
rustc -vV
rustc 1.37.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-pc-windows-gnu
release: 1.37.0-dev
LLVM version: 8.0