Hi Willy, On 18:30 Sun 29 Sep , Willy Tarreau wrote: > That's problematic. The issue was created by the addition of > pcre-config > because some people could not build on their systems in the past. The whole > mess started with the lib64 subdir that broke basically every software > relying on $FOO/lib. So some users had PCRE in /usr/local/{include,lib64} > and could not specify a working PCREDIR. Thus we switched to pcre-config. > And finally since pcre-config is still wrong on some systems (eg: when you > want to use an alternate version such as the JIT-enabled one), we offered > the support for separate PCRE_LIB / PCRE_INC.
Still, this approach does not properly work on most distributions anymore. Debian and Ubuntu are shipping most of the libraries under /usr/lib/<arch>-linux-gnu, but the libdir generated using ${prefix}/lib is still /usr/lib. pcre-config can output the correct output path: $ pcre-config --libs -L/usr/lib/x86_64-linux-gnu -lpcre but we would still end up inserting a system library path using -L. > So maybe we should in fact stop setting PCREDIR to $(pcre-config --prefix), > which will result in PCRE_INC/PCRE_LIB remaining silent unless PCREDIR is > forced. I suspect the following patch should fix it : > > diff --git a/Makefile b/Makefile > index 0529e89..89f9f39 100644 > --- a/Makefile > +++ b/Makefile > @@ -544,7 +544,6 @@ ifneq ($(USE_PCRE)$(USE_STATIC_PCRE)$(USE_PCRE_JIT),) > # Forcing PCREDIR to an empty string will let the compiler use the default > # locations. > > -PCREDIR := $(shell pcre-config --prefix 2>/dev/null || echo > /usr/local) > ifneq ($(PCREDIR),) > PCRE_INC := $(PCREDIR)/include > PCRE_LIB := $(PCREDIR)/lib > Looks good to me, that's what we're essentially doing for the Debian package right now anyway. Another approach would be to manually specify the path to pcre-config (e.g. using a PCRE_CONFIG variable) if desired and get `pcre-config --libs` and `pcre-config --cflags` from there if specified. But pcre is a simple use-case, just specifying includes and libdir should be enough. Thanks, Apollon