compile glib 2.48 does not recognize pcre with utf support

I have compiled pcre 8.38 from source with --enable-utf8 --enable-unicode-properties and a pcretest -C utf retuns 1.

a which pcretest returns /home/mybin/bin/pcretest

However when compiling glib 2.48 using PCRE_LIBS="/home/mybin/lib" PCRE_CFLAGS="/home/mybin/bin" i get a configure error from configure.log

checking for PCRE... yes
checking for Unicode support in PCRE... no
configure: error: *** The system-supplied PCRE does not support Unicode properties or UTF-8.

is there something else I should check to get the glib configure to pass?

Answers


I just ran into his issue as well. Be sure you have $PCRE_INSTALL_DIR/lib in your LD_LIBRARY_PATH as well. That fixed the issue for me.


First, make sure you enable unicode during configuration:

./configure --enable-utf --enable-unicode-properties

and then make. Later, for installation use this:

make pkgconfigdir=/usr/lib/pkgconfig install

If internal glib pcre is acceptable option then you may use --with-pcre in configure.


Run ldconfig after make install step of libpcre. After that try ./configure in glib.


./configure tests UTF-8 support by compiling a small test program (line 27618) and running it:

#include <pcre.h>
int main () {
    int support;
    pcre_config (PCRE_CONFIG_UTF8, &support);
    if (!support)
        return 1;
    pcre_config (PCRE_CONFIG_UNICODE_PROPERTIES, &support);
    if (!support)
        return 1;
    return 0;
}

If that test program can't be compiled and run properly or it returns 1 for any reason then ./configure will say that there isn't UTF-8 support. Check that your operating system can find the shared libraries in your PCRE lib directory. You can do that by compiling the above test program and making sure it can run without crashing due to a missing shared library.

I had that problem but even when I fixed it Glib failed to detect UTF-8 support in PCRE. When that happens you could try editing ./configure to skip over that test but failing that test is hinting at there being some other problem so I wouldn't recommend that.


PCRE_LIBS and PCRE_CFLAGS with just path is not enough.

In my case, compile glib-2.52.3 with pcre-8.38, i used PCRE_CFLAGS="/usr/local/include" PCRE_LIBS="/usr/local/lib", and get a The system-supplied PCRE does not support Unicode properties or UTF-8 result. I followed the config.log, it post this configure:27740: checking for Unicode support in PCRE configure:27766: gcc -o conftest -g -O2 /usr/local/include -pthread conftest.c /usr/local/lib >&5 /usr/local/include: file not recognized: Is a directory collect2: ld returned 1 exit status configure:27766: $? = 1 configure: program exited with status 1

so i changed the flag content, become to this PCRE_CFLAGS="-I/usr/local/include" PCRE_LIBS="-L/usr/local/lib" it tell me configure:27740: checking for Unicode support in PCRE configure:27766: gcc -o conftest -g -O2 -I/usr/local/include -pthread conftest.c -L/usr/local/lib >&5 /tmp/cc8eu7d8.o: In function 'main': /data1/rugalzhang/glib-2.52.3/conftest.c:178: undefined reference to 'pcre_config' /data1/rugalzhang/glib-2.52.3/conftest.c:181: undefined reference to 'pcre_config' collect2: ld returned 1 exit status configure:27766: $? = 1 configure: program exited with status 1

with that, make the final change PCRE_CFLAGS="-I/usr/local/include" PCRE_LIBS="-L/usr/local/lib -lpcre" and it worked for me


I find following words in glib README, it works for me Notes about GLib 2.48 =====================

  • The system copy of PCRE is now used by default to implement GRegex. Configure with --with-pcre=internal if a system PCRE version is unavailable or undesired

I did even another thing to make glib 2.52.3 compile with pcre 8.39

LD_LIBRARY_PATH=$PREFIX/lib ./configure <...>

where $PREFIX/lib is where libpcre.so lies.

Without setting LD_LIBRARY_PATH, in config.log:

./conftest: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

modifying PCRE_CFLAGS or PCRE_LIBS did not help ...


Need Your Help