0
votes

I'm compiling Rust on Windows using mingw_64 and GCC. I get the following error:

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)"

Unlike How do I fix the error "couldn't load codegen backend" on macOS?, the file rustc_codegen_llvm-llvm.dll does live in the correct directory.

1
Could it be another DLL that's missing? I'm thinking maybe a GCC runtime lib (libgcc*.dll, ibstdc++*.dll)rubenvb
@rubenvb how would I find that out?Yair Halberstadt
If you have MSYS2 installed, you could run its ldd utility on the executable (or the mentioned dll) and see if it finds all the dependent DLLs (and where it gets them from). Then figure out if the build procedure can logically find them in the same locations (i.e. are the found DLLs in PATH or next to the executables being run?)rubenvb
i had reported issue to rust github: github.com/rust-lang/rust/issues/61561 , i regularly build rust with msys64 env, i had found the issue 2019.05, but had no time.sailfish009
@rubenvb dumpbin is more useful than ldd in this case. ldd only shows ??? for the missing dependents.sailfish009

1 Answers

1
votes

found the reason, latest mingw gcc 9.1.0 cause some missing dll problem. (although, compile rust source was fine).

if you have old version msys2, this will works for you:

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