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?
dup2.c: In function 'ms_windows_dup2': dup2.c:53:11: warning: cast from function call of type 'intptr_t' to non-matching type 'void *' [-Wbad-function-cast] if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE) ^ error.c:112:1: warning: function declaration isn't a prototype [-Wstrict-prototypes] int strerror_r (); ^ error.c: In function 'is_open': error.c:135:10: warning: cast from function call of type 'intptr_t' to non-matching type 'void *' [-Wbad-function-cast] return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; ^ error.c: In function 'error': error.c:320:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] error_tail (status, errnum, message, args); ^ error.c: In function 'error_at_line': error.c:390:3: warning: function might be possible candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format] error_tail (status, errnum, message, args); ^ fcntl.c: In function 'dupfd': fcntl.c:55:23: warning: cast from function call of type 'intptr_t' to non-matching type 'void *' [-Wbad-function-cast] HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd); ^ fcntl.c: In function 'fcntl': fcntl.c:289:25: warning: cast from function call of type 'intptr_t' to non-matching type 'void *' [-Wbad-function-cast] HANDLE handle = (HANDLE) _get_osfhandle (fd); ^ isatty.c: In function 'rpl_isatty': isatty.c:68:14: warning: cast from function call of type 'intptr_t' to non-matching type 'void *' [-Wbad-function-cast] HANDLE h = (HANDLE) _get_osfhandle (fd); ^ lseek.c: In function 'rpl_lseek': lseek.c:40:14: warning: cast from function call of type 'intptr_t' to non-matching type 'void *' [-Wbad-function-cast] HANDLE h = (HANDLE) _get_osfhandle (fd); ^ nl_langinfo.c: In function 'ctype_codeset': nl_langinfo.c:37:10: warning: unused variable 'buflen' [-Wunused-variable] size_t buflen = 0; ^ nl_langinfo.c: In function 'nl_langinfo': nl_langinfo.c:168:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "ISO-8859-1"; ^ nl_langinfo.c:181:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "%a %b %e %H:%M:%S %Y"; ^ nl_langinfo.c:184:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "%m/%d/%y"; ^ nl_langinfo.c:187:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "%H:%M:%S"; ^ nl_langinfo.c:189:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "%I:%M:%S %p"; ^ nl_langinfo.c:192:9: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "AM"; ^ nl_langinfo.c:197:9: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "PM"; ^ nl_langinfo.c:277:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return ""; ^ nl_langinfo.c:279:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "\0\0\0\0\0\0\0\0\0\0"; ^ nl_langinfo.c:314:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "^[yY]"; ^ nl_langinfo.c:316:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "^[nN]"; ^ nl_langinfo.c:318:7: warning: return discards 'const' qualifier from pointer target type [enabled by default] return "";