Compile error with haproxy-2.1.4 and USE_STATIC_PCRE=1 on CentOS 8

Hi
I am trying to complile haproxy 2.1.4 from source on a CentOS 8 system.
When I use option USE_STATIC_PCRE=1, the make command fails with the following error:

/bin/ld: cannot find -lpcreposix  
/bin/ld: cannot find -lpcre  
collect2: error: ld returned 1 exit status  
make: *** [Makefile:860: haproxy] Error 1  

This is the command I use to run:
make TARGET=linux-glibc USE_LUA=1 USE_OPENSSL=1 USE_REGPARM=1 USE_PCRE=1 USE_STATIC_PCRE=1 USE_SYSTEMD=1 USE_ZLIB=1

Whe I remove “USE_STATIC_PCRE=1” compiling works fine.
Am I missing something?

# cat  /etc/centos-release  
CentOS Linux release 8.1.1911 (Core)  
# uname -a  
Linux testsystem1 4.18.0-147.8.1.el8_1.x86_64 #1 SMP Thu Apr 9 13:49:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux  

Many thanks
Toni

Did you build PCRE statically beforehand or did you just install pcre-devel? Why do you want to use static PCRE?

Hi
I just installed pcre-devel.

In general, I would like to have a solution that is able to match PCRE in the most performing way.
But to be honest, maybe I didn’t fully understand what “static PCRE” means.
I would have thought that it relates to the “o” modifier in /matchregex/o.
But from you answer, I understand that “static” more likely relates to “statically linked/compiled”.

If the latter is the case, then I probably don’t need static pcre.

Many thanks
Toni

You’d probably want to use JIT then (use USE_PCRE_JIT=1 when compling haproxy). You could also take a look at PCRE2 (with JIT). I don’t know whether PCRE2 makes a performance difference though.

You’d have to benchmark your exact use-cases to know what works bests.

However I also have to say that PCRE generally performs very well, so are you sure you actually do have a performance problem with your current setup?

I don’t know what the o modifier is about, can you point me to some documentation?

Correct, that’s what USE_STATIC_PCRE is about. By installing pcre-devel you prepare your system to link dynamically against PCRE, but not statically, which is why the build fails in this case.

I am currently using lots of static strings using “path_beg” in the frontend. It would be good to simplify the config. However, I read that the general recommendation is to refrain from using regex, as it seems to be quite expensive performance-wise. So the answer to your question is “no I am not sure” because I didn’t dare to try regex in high volume traffic yet.

I have been using the /o modifier in perl like 10 years back. It seems that it has become obsolete by the time. I found some documentation here (search for “/o”):
https://perldoc.perl.org/perlop.html

So my main takeway from this conversation so far is to compile with " USE_PCRE_JIT=1" instead of “USE_STATIC_PCRE=1”.

Many thanks!

1 Like