A Mind Lost

Anything and everything.

Tag Archives: windres

MinGW windres.exe “can’t popen” error

I’m not sure what causes it, but the windres.exe from MinGW’s binutils (2.22) package doesn’t work properly, claiming an error of No error.

c:\msys\mingw32\bin\windres.exe: can't popen `c:\msys\mingw32\bin\gcc -E -xc
-DRC_INVOKED  -': No error

Note that this is when running in the MSYS bash shell; I didn’t receive this error when running it from a CMD.EXE compatible console (TCCLE).  I also did not encounter this problem with the MSYS windres.exe (binutils

To fix this, I use a script that I place in ${HOME}/bin/windres.  Since ${HOME}/bin comes before /mingw/bin in my PATH, the shell picks up the script rather than the binary.

#! /bin/sh
/mingw/bin/windres --use-temp-file `echo "$*" | sed 's/\\\\//g'`

The –use-temp-file flag fixes the popen problem.  The text replacement is just an added bonus.  I’ve noticed that when configuring software with autoconf in MinGW, quite often it adds more escaped characters than are necessary to the command-line.  The call to sed removes these unnecessary escape sequences.