# Compile error with haproxy-2.1.4 and USE\_STATIC\_PCRE=1 on CentOS 8

**URL:** <https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202>\
**Category:** Help!\
**Created:** [May 9, 2020, 12:32am UTC](https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202 "2020-05-09T00:32:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toni](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Toni](https://discourse.haproxy.org/u/Toni)\
**Post date:** [May 9, 2020, 12:32am UTC](https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202/1 "2020-05-09T00:32:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [May 9, 2020, 4:49pm UTC](https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202/2 "2020-05-09T16:49:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toni](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Toni](https://discourse.haproxy.org/u/Toni)\
**Post date:** [May 9, 2020, 9:57pm UTC](https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202/3 "2020-05-09T21:57:13Z")

</div>

Hi  
I just installed `pcre-devel`.

> [@lukastribus](#):
>
> Why do you want to use static PCRE?

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

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [May 10, 2020, 9:08am UTC](https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202/4 "2020-05-10T09:08:06Z")

</div>

> [@Toni](#):
>
> In general, I would like to have a solution that is able to match PCRE in the most performing way.

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?

> [@Toni](#):
>
> I would have thought that it relates to the “o” modifier in `/matchregex/o` .

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

> [@Toni](#):
>
> But from you answer, I understand that “static” more likely relates to “statically linked/compiled”.

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.

---

<div class="post-metadata">

**Author:** ![Toni](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Toni](https://discourse.haproxy.org/u/Toni)\
**Post date:** [May 10, 2020, 8:33pm UTC](https://discourse.haproxy.org/t/compile-error-with-haproxy-2-1-4-and-use-static-pcre-1-on-centos-8/5202/5 "2020-05-10T20:33:04Z")

</div>

> [@lukastribus](#):
>
> 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 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.

> [@lukastribus](#):
>
> I don’t know what the o modifier is about, can you point me to some documentation?

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](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!
