[pcre-dev] r977 doesn't build with autotools under Ubuntu 12…

Top Page
Delete this message
Author: Giuseppe D'Angelo
Date:  
To: pcre-dev
Subject: [pcre-dev] r977 doesn't build with autotools under Ubuntu 12.04 x86-64
Hi,
a small bug in r977 prevents it to successfully build under Ubuntu
12.04, x86-64, gcc 4.6.3, binutils 2.22.

Steps to reproduce:
1) libtoolize -c -f && aclocal && autoheader && automake -a -c && autoconf
2) ./configure --enable-utf --enable-pcre16 --enable-jit
--enable-unicode-properties --enable-pcre8

This gives to me this build configuration:
pcre-8.31-RC1 configuration summary:

    Install prefix .................. : /usr/local
    C preprocessor .................. : gcc -E
    C compiler ...................... : gcc
    C++ preprocessor ................ : g++ -E
    C++ compiler .................... : g++
    Linker .......................... : /usr/bin/ld -m elf_x86_64
    C preprocessor flags ............ :
    C compiler flags ................ : -O2
    C++ compiler flags .............. : -O2
    Linker flags .................... :
    Extra libraries ................. :


    Build 8 bit pcre library ........ : yes
    Build 16 bit pcre library ....... : yes
    Build C++ library ............... : yes
    Enable JIT compiling support .... : yes
    Enable UTF-8/16 support ......... : yes
    Unicode properties .............. : yes
    Newline char/sequence ........... : lf
    \R matches only ANYCRLF ......... : no
    EBCDIC coding ................... : no
    Rebuild char tables ............. : no
    Use stack recursion ............. : yes
    POSIX mem threshold ............. : 10
    Internal link size .............. : 2
    Match limit ..................... : 10000000
    Match limit recursion ........... : MATCH_LIMIT
    Build shared libs ............... : yes
    Build static libs ............... : yes
    Use JIT in pcregrep ............. : yes
    Buffer size for pcregrep ........ : 20480
    Link pcregrep with libz ......... : no
    Link pcregrep with libbz2 ....... : no
    Link pcretest with libedit ...... : no
    Link pcretest with libreadline .. : no


3) make.

Step 3) will fail with the error

CCLD pcretest
/usr/bin/ld: pcretest.o: undefined reference to symbol 'pcre_study'
/usr/bin/ld: note: 'pcre_study' is defined in DSO
/home/peppe/projects/src/pcre/.libs/libpcre.so.1 so try adding it to
the linker command line
/home/peppe/projects/src/pcre/.libs/libpcre.so.1: could not read
symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: *** [pcretest] Error 1

make V=1 shows the problematic command line:

/bin/bash ./libtool --tag=CC --mode=link gcc -O2 -o pcretest
pcretest.o pcre_printint.o pcre16_printint.o libpcreposix.la
libpcre16.la
libtool: link: gcc -O2 -o .libs/pcretest pcretest.o pcre_printint.o
pcre16_printint.o ./.libs/libpcreposix.so ./.libs/libpcre16.so

This last one is wrong and will fail due to these changes in ld:

https://fedoraproject.org/wiki/UnderstandingDSOLinkChange
https://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking

which mandate that all required shared objects to be passed to ld,
i.e. do not rely to the implicit linking from libpcreposix.so to
libpcre.so -- as shown by ldd, this is the case:

$ ldd .libs/libpcreposix.so
    linux-vdso.so.1 =>  (0x00007fff66fff000)
    libpcre.so.1 => /home/peppe/projects/src/pcre/.libs/libpcre.so.1
(0x00007fc554d68000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc55498e000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fc5551cb000)


Manually adding libpcre.la to libtool's command line solves the
problem. The whole report applies to pcregrep as well.

Thanks,
--
Giuseppe D'Angelo