A Mind Lost

Anything and everything.

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 2.19.51.20090704).

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.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: