threads / discuss / 45554

Git and PCRE2 vs PCRE?

Subject: Git and PCRE2 vs PCRE?

## tl;dr

4 messages between Mar 30, 2017 and Mar 30, 2017.

replies: 3people: 3as markdown or json

Jeffrey Walton· Mar 30, 2017, 20:59 UTC · lore
Some more 2.12.2 testing on Solaris 11.3 x86_64:
    ...
    CC ident.o
    CC kwset.o
    CC line-log.o
    CC levenshtein.o
    CC line-range.o
    CC list-objects.o
In file included from revision.h:5:0,
                 from line-log.c:10:
grep.h:5:18: fatal error: pcre.h: No such file or directory
 #include <pcre.h>
                  ^
compilation terminated.
gmake: *** [line-log.o] Error 1

Configure has an option for libpcre, but its not clear to me how to fine tune it for libpcre2:

$ ./configure --help | /usr/gnu/bin/grep -A 2 -i pcre
  --with-libpcre          support Perl-compatible regexes (default is NO)
                          ARG can be also prefix for libpcre library and
                          headers
Is it possible to use PCRE2 with Git? If so, how do I tell Git to use PCRE2?
Thanks in advance.
**********

$ ls /usr/local/include/pcre* /usr/local/include/pcre2.h /usr/local/include/pcre2posix.h

$ ls /usr/local/lib64/libpcre* /usr/local/lib64/libpcre2-16.a /usr/local/lib64/libpcre2-16.la /usr/local/lib64/libpcre2-16.so /usr/local/lib64/libpcre2-16.so.0 /usr/local/lib64/libpcre2-16.so.0.5.0 /usr/local/lib64/libpcre2-32.a /usr/local/lib64/libpcre2-32.la /usr/local/lib64/libpcre2-32.so /usr/local/lib64/libpcre2-32.so.0 /usr/local/lib64/libpcre2-32.so.0.5.0 /usr/local/lib64/libpcre2-8.a /usr/local/lib64/libpcre2-8.la /usr/local/lib64/libpcre2-8.so /usr/local/lib64/libpcre2-8.so.0 /usr/local/lib64/libpcre2-8.so.0.5.0 /usr/local/lib64/libpcre2-posix.a /usr/local/lib64/libpcre2-posix.la /usr/local/lib64/libpcre2-posix.so /usr/local/lib64/libpcre2-posix.so.1 /usr/local/lib64/libpcre2-posix.so.1.0.1

Jeff King· Mar 30, 2017, 21:22 UTC · re: Jeffrey Walton · lore

Re: Git and PCRE2 vs PCRE?

On Thu, Mar 30, 2017 at 04:59:27PM -0400, Jeffrey Walton wrote:
Show 9 quoted lines
> Configure has an option for libpcre, but its not clear to me how to
> fine tune it for libpcre2:
> 
> $ ./configure --help | /usr/gnu/bin/grep -A 2 -i pcre
>   --with-libpcre          support Perl-compatible regexes (default is NO)
>                           ARG can be also prefix for libpcre library and
>                           headers
> 
> Is it possible to use PCRE2 with Git? If so, how do I tell Git to use PCRE2?

No, I don't think so. According to the release announcement for pcre2, the API is not compatible with the original:

  https://lists.exim.org/lurker/message/20150105.162835.0666407a.en.html

So even if you could tweak the build to use it, it would not do the right thing. Somebody would have to add code for the new library, and probably have a USE_LIBPCRE2 flag.

I don't know offhand if there are compelling reasons to do that work.
-Peff
Junio C Hamano· Mar 30, 2017, 21:23 UTC · re: Jeffrey Walton · lore

Re: Git and PCRE2 vs PCRE?

Jeffrey Walton <noloader@gmail.com> writes:
> Is it possible to use PCRE2 with Git? If so, how do I tell Git to use PCRE2?

Given that pcre2's symbols are all prefixed with pcre2_ (I only checked http://www.pcre.org/current/doc/html/pcre2api.html) and we do not see any hits from "git grep pcre2", I do not think you can just "configure" Git to use it. Unless pcre2 library has a drop-in replacement backward compatibility mode with pcre library, that is.

It probably is possible to use PCRE2 with Git by adding similar amount of code to grep.[ch] as we have support for pcre and that would be the way you tell Git to use PCRE2, but I think that is probably not the questino you are asking.

Jeffrey Walton· Mar 30, 2017, 22:04 UTC · re: Junio C Hamano · lore

Re: Git and PCRE2 vs PCRE?

On Thu, Mar 30, 2017 at 5:23 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Jeffrey Walton <noloader@gmail.com> writes:
>
>> Is it possible to use PCRE2 with Git? If so, how do I tell Git to use PCRE2?
>
> Given that pcre2's symbols are all prefixed with pcre2_ (I only
> checked http://www.pcre.org/current/doc/html/pcre2api.html) and we
> do not see any hits from "git grep pcre2", I do not think you can
> just "configure" Git to use it.  Unless pcre2 library has a drop-in
> replacement backward compatibility mode with pcre library, that is.
>
> It probably is possible to use PCRE2 with Git by adding similar
> amount of code to grep.[ch] as we have support for pcre and that
> would be the way you tell Git to use PCRE2, but I think that is
> probably not the questino you are asking.
Ack, thanks Jeff and Junio. Its no big deal to me.

I'm not a PCRE user, so I'm not familiar with the extra gyrations needed for the migration.

I'll get the original PCRE installed.
Thanks again.

← back to recent threads