Trying to compile anything depending on a resource (.rc) file using on an amd64 computer using target i686-pc-windows-gnu yields the following error:
linking with `i686-w64-mingw32-gcc` failed: exit code: 1
|
= note: "i686-w64-mingw32-gcc" <lots of args...>
= note: <project root>\target\debug\build\<project name>-<hash>\out/libresources.a: file not recognized: File format not recognized
This error seems to stem from an incorrect use of mingw-w64's windres.exe resource compiler (just in this case), in windows_not_msvc.rs.
By default,mingw-w64's windres.exe compiles the input resource file into an amd64 object file format (at least when running on an amd64 computer), which is incompatible with i686 targets, thereby causing linking to fail.
A fix for this would consist in detecting that i686 machines are being targeted (using cfg!(target_arch = "x86_64")), and using flag --target=pe-i386 just after -O coff/--output-format=coff, like this:
As a temporary workaround, using the above command line manually to compile the resource file and replacing the invalid libresources.a resource file generated by this crate with our manually compiled file fixes builds broken by this issue.
Trying to compile anything depending on a resource (
.rc
) file using on an amd64 computer using targeti686-pc-windows-gnu
yields the following error:This error seems to stem from an incorrect use of
mingw-w64
'swindres.exe
resource compiler (just in this case), inwindows_not_msvc.rs
.By default,
mingw-w64
'swindres.exe
compiles the input resource file into anamd64
object file format (at least when running on an amd64 computer), which is incompatible withi686
targets, thereby causing linking to fail. A fix for this would consist in detecting thati686
machines are being targeted (usingcfg!(target_arch = "x86_64")
), and using flag--target=pe-i386
just after-O coff
/--output-format=coff
, like this:As a temporary workaround, using the above command line manually to compile the resource file and replacing the invalid
libresources.a
resource file generated by this crate with our manually compiled file fixes builds broken by this issue.