Notes for 2025-04-10

Resolving APR Not Found Error in Apache Build

./configure --enable-proxy --enable-proxy-http --enable-ssl --enable-rewrite
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... no
configure: error: APR not found.  Please read the documentation.

When building Apache and encountering the error APR not found. Please read the documentation., follow these steps based on your operating system:

CentOS/RHEL-based Systems

Run the following command to install the required dependencies:

yum install -y apr-devel apr-util-devel

Debian/Ubuntu-based Systems

Run the following command to install the required dependencies:

apt-get install -y libapr1-dev libaprutil1-dev

Re-run the Configuration

After installing the dependencies, re-run the configuration command:

./configure --enable-proxy --enable-proxy-http --enable-ssl --enable-rewrite
 ./configure --enable-proxy --enable-proxy-http --enable-ssl --enable-rewrite
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to "  -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in /hms/installs/httpd-2.4.43':
configure: error: C compiler cannot create executables
See config.log' for more details

Step-by-step Fix

  1. Check if gcc is installed and working
gcc --version
  1. If that fails, install it:
yum groupinstall "Development Tools" -y

or individually:

yum install gcc -y
./configure --enable-proxy --enable-proxy-http --enable-ssl --enable-rewrite
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure: 
configure: Configuring Apache Portable Runtime library...
configure: 
checking for APR... yes
  setting CC to "gcc"
  setting CPP to "gcc -E"
  setting CFLAGS to "  -pthread"
  setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
  setting LDFLAGS to " "
configure: 
configure: Configuring Apache Portable Runtime Utility library...
configure: 
checking for APR-util... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for gcc option to accept ISO C99... none needed
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

Fix: Install PCRE development libraries

  1. Since you're on a CentOS/RHEL-like system, run:
yum install -y pcre-devel
  1. If you're on a Debian/Ubuntu system, use:
apt-get install -y libpcre3-dev

Written by A.M. Rinas