Re: [pcre-dev] Problem with "any" newline (and other 7.1 iss…

Αρχική Σελίδα
Delete this message
Συντάκτης: Sheri
Ημερομηνία:  
Προς: pcre-dev
Παλιά Θέματα: Re: [pcre-dev] Problem with "any" newline
Αντικείμενο: Re: [pcre-dev] Problem with "any" newline (and other 7.1 issues)
Hi Philip (I've been misspelling your name previously, sorry) and Bob
(please see below for possible issue for make check),

I taught myself how to patch a file, then reconfigured and rebuilt RC4.

I noticed a couple of "auto-imports" while building -- this is the
feature people say works on gcc but not in Microsoft toolchain.

/bin/sh ./libtool --tag=CC   --mode=link gcc  -O3 -s -no-undefined 
-version-info 0:0:0  -o libpcreposix.la -rpath /usr/local/lib 
pcreposix.lo libpcre.la
gcc -shared  .libs/pcreposix.o  ./.libs/libpcre.dll.a  -o 
.libs/libpcreposix-0.dll -Wl,--enable-auto-image-base -Xlinker 
--out-implib -Xlinker .libs/libpcreposix.dll.a
Info: resolving _pcre_free by linking to __imp__pcre_free (auto-import)
Creating library file: .libs/libpcreposix.dll.a
ar cru .libs/libpcreposix.a  pcreposix.o
ranlib .libs/libpcreposix.a
creating libpcreposix.la
............
g++ -g -O2 -o .libs/pcrecpp_unittest.exe pcrecpp_unittest.o  
./.libs/libpcrecpp.dll.a /C/pcre71RC4-EXP/testpatch/.libs/libpcre.dll.a 
-L/usr/local/lib
Info: resolving pcrecpp::no_arg      by linking to 
__imp___ZN7pcrecpp6no_argE (auto-import)
............
g++ -g -O2 -o .libs/pcre_scanner_unittest.exe pcre_scanner_unittest.o  
./.libs/libpcrecpp.dll.a /C/pcre71RC4-EXP/testpatch/.libs/libpcre.dll.a 
-L/usr/local/lib
Info: resolving pcrecpp::no_arg      by linking to 
__imp___ZN7pcrecpp6no_argE (auto-import)


I have not had a reply from Alan about using the 2 libraries files in
our environment.

However the following magic from the old make file does create a
pcre.dll like the old one (don't know how the auto-import currently in
pcreposix affects it). For some reason I can't figure out how to make
these lines into a script so that all the commands get run (it stops
after the libtool bit in the second command, which takes a little time
to complete). But if I paste in the commands to the msys shell and
execute one after the other, it works.

If you could include such a script (for optional use by msys/mingw
users) for those of us who prefer the pcre.dll structure we had before,
I would be most grateful. First, when we're set up to use a shared
library (usually) all that is necessary for applying pcre updates is to
update the library. Those of us interested in keeping our pcre
capabilities up-to-date do not always share the same priorities and
agenda as those who maintain the other components that are linked
directly or indirectly with pcre. The new structure requires more of
their attention than necessary. Second (which Alan still needs to verify
with respect to the output of msys/mingw and RC4) the location of the
dll files may become an issue when the posix library is separate (where
the posix library can't find the pcre library unless its on the path).
Third, as built by the new make process, the libpcre-0.dll file is
larger than a combined pcre.dll (which combines pcre and pcreposix) that
also has coff info in it. (new structure is about 50K larger - I see no
reason for it - and if I remove my coff file from pcre.dll the
difference is even greater, about 56K. I use -O3 -s on both.).
#=================================================================
$ rm -f libpcre.la

$ /bin/sh ./libtool --mode=link gcc -export-symbols-regex '^[^_]'  -I. 
-I. -rpath /usr/local/lib -version-info \
    '0:1:0' -o libpcre.la pcre_chartables.lo pcre_compile.lo 
pcre_config.lo pcre_dfa_exec.lo pcre_exec.lo pcre_fullinfo.lo 
pcre_get.lo pcre_globals.lo pcre_info.lo pcre_maketables.lo 
pcre_newline.lo pcre_ord2utf8.lo pcre_refcount.lo pcre_study.lo 
pcre_tables.lo pcre_try_flipped.lo pcre_ucp_searchfuncs.lo 
pcre_valid_utf8.lo pcre_version.lo pcre_xclass.lo pcreposix.lo


$ gcc -O3 -s -shared -o .libs/pcre.dll ../pcre.coff \
-Wl,--whole-archive .libs/libpcre.a \
-Wl,--out-implib,.libs/libpcre.dll.a \
-Wl,--output-def,.libs/pcre.dll-def \
-Wl,--export-all-symbols \
-Wl,--no-whole-archive

# ========don't know what this part is for but it doesn't alter the
pcre.dll file========
$ sed -e "s#dlname=''#dlname='../bin/pcre.dll'#" \
-e "s#library_names=''#library_names='libpcre.dll.a'#" \
< .libs/libpcre.lai > .libs/libpcre.lai.tmp && \
mv -f .libs/libpcre.lai.tmp .libs/libpcre.lai

$ sed -e "s#dlname=''#dlname='../bin/pcre.dll'#" \
-e "s#library_names=''#library_names='libpcre.dll.a'#" \
< libpcre.la > libpcre.la.tmp && \
mv -f libpcre.la.tmp libpcre.la
#=================================================================

> BTW, there are various ".exe" files in my build dir (including a
> > "pcretest.exe") that are unreasonably small and do not work. The ones in
> > my .libs dir do work. I don't know if "make check" might be trying to
> > run the ones in the build dir (current dir while building), but the
> > "pcretest.exe" there does hang my DOS window if I try to run it.
>
>
> 'fraid I can't help with that - Windows expert needed.

After "make" there is a 4K file in the build directory called pcretest.

Apparently if you run make install or make check, this file becomes
"pcretest.exe." It has this at the top of the file:

#! /bin/sh

# pcretest - temporary wrapper script for .libs/pcretest.exe
# Generated by ltmain.sh - GNU libtool 1.5.22 (1.1220.2.365 2005/12/18
22:14:06)

I don't think it is appropriate for a script file to be named xxx.exe
and it probably has something to do with "make check" not working. Make
check needs to run the real pcretest.exe (which is not in the build
dir). Maybe Bob can figure out where it going wrong.

Regards,
Sheri

>




Philip Hazel wrote:
>> I will myself do a build with "any" to see if I can reproduce this
>> behaviour.
>>
>
> OK, it's yet another buglet in pcretest's handling of /g with "any". It
> wasn't noticing the default. Here is the patch against -RC4:
>
> <snip>
> *** pcretest.c.rc4    Thu Apr  5 10:06:44 2007
> --- pcretest.c    Thu Apr  5 10:15:47 2007
> ***************
> *** 2232,2240 ****
>           if (g_notempty != 0)
>             {
>             int onechar = 1;
>             use_offsets[0] = start_offset;
> !           if ((((real_pcre *)re)->options & PCRE_NEWLINE_BITS) ==
> !                   PCRE_NEWLINE_ANY &&
>                 start_offset < len - 1 &&
>                 bptr[start_offset] == '\r' &&
>                 bptr[start_offset+1] == '\n')
> --- 2232,2249 ----
>           if (g_notempty != 0)
>             {
>             int onechar = 1;
> +           unsigned int obits = ((real_pcre *)re)->options;
>             use_offsets[0] = start_offset;
> !           if ((obits & PCRE_NEWLINE_BITS) == 0)
> !             {
> !             int d;
> !             (void)pcre_config(PCRE_CONFIG_NEWLINE, &d);
> !             obits = (d == '\r')? PCRE_NEWLINE_CR :
> !                     (d == '\n')? PCRE_NEWLINE_LF :
> !                     (d == ('\r'<<8 | '\n'))? PCRE_NEWLINE_CRLF :
> !                     (d == -1)? PCRE_NEWLINE_ANY : 0;
> !             }
> !           if ((obits & PCRE_NEWLINE_BITS) == PCRE_NEWLINE_ANY &&
>                 start_offset < len - 1 &&
>                 bptr[start_offset] == '\r' &&
>                 bptr[start_offset+1] == '\n')
> <snap>

>
> Philip
>
>