Re: [pcre-dev] pcre static build on mingw32, no joy so far.

Top Page
Delete this message
Author: David Mathog
Date:  
To: Nigel Metheringham, David Mathog, pcre-dev
Subject: Re: [pcre-dev] pcre static build on mingw32, no joy so far.
Nigel Metheringham wrote:

> On 6 Jun 2011, at 23:10, David Mathog wrote:
> >> 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
>
> -l and -L are positional qualifiers.
>
> If you are trying to use a library in a particular directory, then
> the -Ldirectory must go before the -llibrary - and normally both of the
> link flags would go towards the end of the command although I suspect
> that part is just convention


Except that doesn't work either:

gcc -Wall -std=c99 -pedantic -lm -O3 -DMAXINFILE=20 -DPCRE_STATIC
-I/usr/local/include -L/usr/local/lib -lpcre -static -o extra
ct extract.c
C:\DOCUME~1\david\LOCALS~1\Temp\ccHv3ooN.o:extract.c:(.text+0x8b77):
undefined reference to `pcre_compile'
etc.

Only this form works (so far):

gcc -Wall -std=c99 -pedantic -lm \
-I/usr/local/include -DPCRE_STATIC -DMAXINFILE=20 \
-static -o extract extract.c /usr/local/lib/libpcre.a

Regards,

David Mathog
mathog@???
Manager, Sequence Analysis Facility, Biology Division, Caltech