Any pointers on building and linking to a static PCRE library using mingw? I have tried about a dozen different things and it always comes down to some variation of this error at the point where the build tries to link to the static library:
C:\DOCUME~1\david\LOCALS~1\Temp\ccI6Zl3a.o:extract.c:(.text+0x8b77): undefined r eference to `pcre_compile' C:\DOCUME~1\david\LOCALS~1\Temp\ccI6Zl3a.o:extract.c:(.text+0xbf6b): undefined r eference to `pcre_compile' C:\DOCUME~1\david\LOCALS~1\Temp\ccI6Zl3a.o:extract.c:(.text+0x21751): undefined reference to `pcre_exec' C:\DOCUME~1\david\LOCALS~1\Temp\ccI6Zl3a.o:extract.c:(.text+0x29533): undefined reference to `pcre_compile' collect2: ld returned 1 exit status Starting with a freshly installed mingw with msys on XP SP3, this version: MSYS 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 unknown; targ=MINGW32 GNU bash, version 3.1.17(1)-release (i686-pc-msys); ENV=.profile GNU Make 3.81This program built for i686-pc-msys; MAKE_MODE=unix gcc.exe (GCC) 4.5.2; targ=MINGW32 GNU ld (GNU Binutils) 2.21 downloaded, unpacked pcre 8.12, buit it with ./configure --disable-cpp --disable-shared --enable-newline-is-anycrlf make make test (first part passed, the rest failed) make install Seems to have built something, as these are in /usr/local/lib -rw-r--r-- 1 david Administrators 130382 Jun 3 15:10 libpcre.a -rw-r--r-- 1 david Administrators 866 Jun 3 15:10 libpcre.la -rw-r--r-- 1 david Administrators 3110 Jun 3 15:10 libpcreposix.a -rw-r--r-- 1 david Administrators 907 Jun 3 15:10 libpcreposix.la Try to build my application (variations of the following work fine on linux and solaris, albeit dynamic linking in both of those cases): $ gcc -Wall -std=c99 -pedantic -lm -O3 -DMAXINFILE=20 \ -lpcre -I/usr/local/include -L/usr/local/lib \ -static -DPCRE_STATIC -o extract extract.c and the error messages at top result. The strings appear in libpcre.a but possibly prefixed by an underscore: $ strings /usr/local/lib/libpcre.a | grep pcre_compile _pcre_compile2 _pcre_compile pcre_compile.o/ 1307138907 0 0 100666 46478 ` pcre_compile.c _pcre_compile2 _pcre_compile It is definitely finding libpcre.a (and libpcreposix.a if that is added too, but it seems to make no difference) because remove -L/usr/local/lib and the error changes to: c:/progs/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lpcre Any help would be greatly appreciated. Thanks, David Mathog [email protected] Manager, Sequence Analysis Facility, Biology Division, Caltech -- ## List details at https://lists.exim.org/mailman/listinfo/pcre-dev
