在安装Apache到Ubuntu 11.10时,我遇到了以下错误:
configure: error: APR未找到。请阅读文档。
我按照这里的指示进行操作,但是接下来我又遇到了以下错误:
configure: error: 找不到libpcre的pcre-config。需要PCRE,可以从http://pcre.org/获取。
我做错了什么,如何解决?
在安装Apache到Ubuntu 11.10时,我遇到了以下错误:
configure: error: APR未找到。请阅读文档。
我按照这里的指示进行操作,但是接下来我又遇到了以下错误:
configure: error: 找不到libpcre的pcre-config。需要PCRE,可以从http://pcre.org/获取。
我做错了什么,如何解决?
1. 从 PCRE.org 下载 PCRE。
2. 使用前缀编译并安装它:
./configure --prefix=/usr/local/pcre
make
make install
3. 回到你的 Apache 安装位置并使用 PCRE 编译 Apache:
--with-pcre=/usr/local/pcre
对于我使用的Fedora Linux系统,只需安装即可:yum install -y pcre-devel
。之后甚至不必使用--with-pcre
参数。
sudo apt-get install libpcre3-dev
命令(或者根据你在未来的时候所拥有的包/版本进行安装),然后回到之前出现错误的./configure
选项中,尝试完全相同的选项。现在应该可以正常工作了。 - daemone在一个干净的 Debian 9.5 安装中,在安装 Apache 时,为避免错误需要安装一些包和库。下面我展示了可能出现的错误类型及其相应的解决方案:
配置
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
然后我指定将其安装在路径 /usr/local
,而不是 /usr/local/apache2
,否则会导致库错误。希望创建 httpd 的库放置在 /usr/local/lib
中,以便动态链接器可以找到它们。
$ configure --prefix /usr/local
编译
在Debian干净安装的过程中,除了要安装一些软件包,还需要进行以下编译操作,以避免出现错误。
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory.
$ sudo apt-get install libexpat1-dev
.
建议使用-j3参数来加速编译,但也可以忽略该参数。
$ make -j3
我在CentOS上用pcre编译apache2时遇到了其他问题。我把pcre安装在了另一个位置“/custom/location/pcre”,但配置命令出现了以下错误。
configure: error: Did not find pcre-config script at "/custom/location/pcre"
为解决此问题,需要将标记--with-pcre=/custom/location/pcre
更改为--with-pcre=/custom/location/pcre/bin/pcre2-config
顺便提一下,在构建httpd之前,需要在CentOS 7.6上安装pcre-devel。
`$ sudo yum install pcre-devel`
--with-pcre
来指向pcre-config。只需要pcre
路径即可。./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre
sudo apt-get install libpcre3-dev
在Ubuntu中。这对我有用
./configure --prefix /u01/apache --with-included-apr --with-pcre=/usr/local/pcre/bin/pcre2-config
./configure --with-pcre=/usr/local/pcre/pcre-config
。 - Troy Knapp