Subject: Cross compiling grep for Mingw-w64 and wildcards don't work

From: Guitar Hero <[email-masked]>
Date: Wed, 4 Feb 2015 19:24:34 -0500

Hello I have cross-compiled grep for Windows using the mingw-w64 32-bit
toolchain. I have some problems with it on Windows and I had some problems
building. The steps I took in Ubuntu were:

sudo apt-get install gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-tool
sudo apt-get install autopoint bison libbison-dev gperf texinfo

Clone the grep repo; currently at master 846e7ee.

./bootstrap
./configure --host=i686-w64-mingw32

There were errors because Werror is enabled. I edited the lib/Makefile
directly to remove -Werror from WERROR_CFLAGS. I built again and got
warnings like "cast from function call of type 'intptr_t' to non-matching
type 'void *'". A list of the warnings is attached.

Now I have a grep.exe but wild cards aren't working from the command
prompt. And from the msys bash shell directories are bad file descriptor.

grep -r a *
grep: *: Invalid argument

>From bash I get bad file descriptors for directories:

$ /c/grep -r a *
c:\grep.exe: dir: Bad file descriptor

I really would like to use grep on windows, primarily from the command
prompt. I don't know if I've done anything that is wrong or maybe there is
a bug somewhere. Unfortunately I don't think I'll be able to fix what is
happening. Can you help?