我正在使用 mingw_64 和 GCC 在 Windows 上编译 Rust。我收到以下错误:
error: couldn't load codegen backend "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": "The specified procedure could not be found. (os error 127)"
不同于How do I fix the error "couldn't load codegen backend" on macOS? ,文件 rustc_codegen_llvm-llvm.dll
确实位于正确的目录中。
最佳答案
找到原因了,最新的mingw gcc 9.1.0 导致一些dll丢失的问题。 (虽然,编译 rust 源代码很好)。
如果你有旧版本的 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
关于windows - 使用 mingw_64 在 Windows 上编译 Rust 时无法加载代码生成后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56473344/