https://bugs.exim.org/show_bug.cgi?id=2067
Bug ID: 2067 Summary: Undefined references to iswild and init_colour_output when building with mingw Product: PCRE Version: 10.23 (PCRE2) Hardware: x86-64 OS: Windows Status: NEW Severity: bug Priority: medium Component: Code Assignee: p...@hermes.cam.ac.uk Reporter: tony.kel...@juliacomputing.com CC: pcre-dev@exim.org Using MinGW-w64 gcc, either i686 or x86_64, I get a failure to link pcre2grep.exe with 10.23. This is a regression relative to 10.22. CCLD pcre2grep.exe src/pcre2grep-pcre2grep.o:pcre2grep.c:(.text+0x25bc): undefined reference to `iswild' src/pcre2grep-pcre2grep.o:pcre2grep.c:(.text.startup+0xada): undefined reference to `init_colour_output' collect2: error: ld returned 1 exit status make[3]: *** [Makefile:1612: pcre2grep.exe] Error 1 make[2]: *** [Makefile:1255: all] Error 2 I can give more complete reproduction steps, given a distribution or build environment of choice (most of them have cross-compilers available in their repos these days, making reproduction of this fairly easy from linux, mac, cygwin, etc). Resolution is pretty simple, the ifdefs just need adjusting. Something like the following patch: diff --git a/src/pcre2grep.c b/src/pcre2grep.c index e98d743..f00dac2 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -628,7 +628,7 @@ z/OS, and "no support". */ /************* Directory scanning Unix-style and z/OS ***********/ -#if (defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS +#if ((defined HAVE_SYS_STAT_H && defined HAVE_DIRENT_H && defined HAVE_SYS_TYPES_H) || defined NATIVE_ZOS) && !defined WIN32 #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> Since mingw-w64 has versions of those 3 headers, it was going down the unix path there. Later in the file, there is code that uses iswild and init_colour_output under #ifdef WIN32, but they were never defined in the unix code. Other options could also work here, like moving the definitions for iswild and init_colour_output to only depend on #ifdef WIN32, and still let mingw use the unix-style code for directory scanning. It looks like 10.22 would have used that code. Not sure what consequences the switch would have, I primarily use libpcre2. -- You are receiving this mail because: You are on the CC list for the bug. -- ## List details at https://lists.exim.org/mailman/listinfo/pcre-dev