在 配置 ./configure --prefix=/usr/local/apache 出现以下错误

报错1:

checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in

安装gcc :yum install -y gcc

报错2:

pcre报错 checking for pcre-config... false

解决办法: yum install pcre pcre-devel

报错3:

checking for APR... no configure: error: APR not found. Please read the documentation

下载apr:wget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz

tar -zxvf apr-1.6.3.tar.gz

cp -r apr-1.6.3 /usr/local/src/httpd-2.4.34/srclib/apr

cd apr-1.6.3

./configure --prefix=/usr/local/apr

make && make install

报错3.1:
checking for APR-util... no configure: error: APR-util not found. Please read the documentation

wget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz

tar -zxvf apr-util-1.6.1.tar.gz

cp -r apr-util-1.6.1 /usr/local/src/httpd-2.4.34/srclib/apr-util

cd apr-util-1.6.1

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr

make

make install

在编译apr-util 可能也会报错xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

yum install expat-devel安装该库,安装完再次编译

然后重新配置apache 并编译安装:

cd httpd-2.4.34

./configure --with-included-apr --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --nable-mods-shared=most

make

make install

补充:
make[1]: 离开目录“/usr/local/src/httpd-2.4.34/support”
make: *** [all-recursive] 错误 1

解决办法: make clean 然后重新./configure make