47

When installing Apache on Ubuntu 11.10, I get the following error:

configure: error: APR not found. Please read the documentation.

I followed the instructions here, then, I get the error below:

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

What am I doing wrong and how can I resolve it?

nyedidikeke
  • 6,899
  • 7
  • 44
  • 59
Myjab
  • 924
  • 1
  • 7
  • 22

8 Answers8

91

1. Download PCRE from PCRE.org

2. Compile it with a prefix and install it:

./configure --prefix=/usr/local/pcre
make
make install

3. Go back to where your Apache installation is and compile Apache with PCRE:

--with-pcre=/usr/local/pcre
uınbɐɥs
  • 7,236
  • 5
  • 26
  • 42
WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138
  • 29
    I had to designate the pcre config location explicitly like `./configure --with-pcre=/usr/local/pcre/pcre-config` in CentOS 6.3 – Troy Knapp Aug 21 '12 at 00:54
  • Does the httpd make process statically link with PCRE? or do I need to include them with the compiled httpd stuff if I tar it and share it? – Nicholas Terry Nov 02 '13 at 01:12
  • 3
    Same here, I needed to state the full path name of the file for RHEL 5: --with-pcre=/usr/local/bin/pcre-cofnig – Eric Mar 07 '15 at 00:38
  • 2
    Eric the spelling mistake for config in your comment wasted my two hours x( please edit – MohitC Feb 16 '16 at 06:06
  • 12
    and finally after several hours my command ./configure --with-included-apr --with-pcre=/usr/local/pcre/bin/pcre2-config is successful.. Never give up!!!!! :) – Triven Apr 16 '16 at 08:05
  • Works on Oracle Linux 6.10 with step three (3) as `--with-pcre=/usr/local/pcre/bin/pcre2-config` instead of `--with-pcre=/usr/local/pcre`. – nyedidikeke Sep 16 '18 at 11:06
  • i had to give it the full path to the script `pcre2-config` too – Tarik Waleed Sep 30 '22 at 16:45
18

For me (Fedora Linux), it was enough to just install the pcre-devel: yum install -y pcre-devel. Didn't even have to use --with-pcre afterwards.

Cleto Gadelha
  • 1,083
  • 9
  • 14
emboss
  • 38,880
  • 7
  • 101
  • 108
  • 5
    This was all I needed in Ubuntu as well. Do `sudo apt-get install libpcre3-dev` (or, you know, whichever package/version is available in your time, Future Boy), then go back and try exactly the same options on `./configure` as got the error originally. Should work now. – daemone Dec 19 '14 at 14:46
  • Works fine for RedHat 6, too. – Halmackenreuter Feb 11 '15 at 11:09
10

Debian

In a clean installation of Debian 9.5, during the installation of Apache it is necessary to have some packages and libraries to avoid errors. Next I show the type of error and its respective solution

Configuration

  • configure: error: no acceptable C compiler found in $PATH

    $ sudo apt-get install build-essential

  • configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

    $ sudo apt-get install libpcre3-dev

Then I make the configuration indicating that it is installed in the path /usr/local and not in /usr/local/apache2, otherwise I will have library errors. The idea is that the libraries created for httpd end in /usr/local/lib so that the dynamic linker knows them.

$ configure --prefix /usr/local

Compilation

And for the compilation the following the installation of some packages also would avoid us errors in a clean installation of Debian.

  • xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory.

    $ sudo apt-get install libexpat1-dev.

It is recommended to use the -j3 parameter to make the compilation faster. Although it could also be ignored.

$ make -j3
Braian Coronel
  • 22,105
  • 4
  • 57
  • 62
4

I was other problem compiling apache2 in CentOS with pcre. I installed pcre in other location "/custom/location/pcre" and configure command throw the following error

configure: error: Did not find pcre-config script at "/custom/location/pcre"

to solve it changing the flag --with-pcre=/custom/location/pcre to --with-pcre=/custom/location/pcre/bin/pcre2-config

fhuertas
  • 4,764
  • 2
  • 17
  • 28
  • 1
    I had exactly the same problem and using ./configure --with-included-apr --with-pcre=/usr/local/pcre/bin/pcre2-config solved it for me - wonder why was this ever downvoted !! – Yogesh Devi Jan 16 '17 at 11:18
2

BTW, on CentOS 7.6 before building httpd, please install pcre-devel

`$ sudo yum install pcre-devel` 
1

In RHEL 3 is not necessary setting parameter --with-pcre pointing to pcre-config. Only need pcre path

My configure command:

./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre
albertoiNET
  • 1,280
  • 25
  • 34
1

This worked for me

./configure --prefix /u01/apache --with-included-apr --with-pcre=/usr/local/pcre/bin/pcre2-config

Suresh Ram
  • 107
  • 1
  • 4
  • I also had to point to the config in the bin directly. Possibly because I had installed pcre with a custom prefix? – Laura Jun 28 '23 at 15:38
1

This worked for me: sudo apt-get install libpcre3-dev

In ubuntu

Yash Hax
  • 76
  • 1