46

在 Ubuntu 11.10 上安装 Apache 时,出现以下错误:

配置:错误:未找到 APR。请阅读文档。

我按照此处的说明进行操作,然后出现以下错误:

配置:错误:找不到 libpcre 的 pcre-config。PCRE 是必需的,可从http://pcre.org/获得

我做错了什么,我该如何解决?

4

7 回答 7

91

1. 从PCRE.org下载 PCRE

2.用前缀编译并安装:

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

3. 回到您的 Apache 安装位置并使用 PCRE 编译 Apache:

--with-pcre=/usr/local/pcre
于 2012-05-23T09:35:02.333 回答
18

对我(Fedora Linux)来说,只需安装 pcre-devel: 就足够了yum install -y pcre-devel。以后也不必用--with-pcre了。

于 2013-10-25T23:37:20.250 回答
7

Debian

在 Debian 9.5 的全新安装中,在安装 Apache 期间,必须有一些软件包和库以避免错误。接下来我展示错误的类型及其相应的解决方案

配置

  • 配置:错误:在 $PATH 中找不到可接受的 C 编译器

    $ sudo apt-get install build-essential

  • 配置:错误:找不到 libpcre 的 pcre-config。PCRE 是必需的,可从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:致命错误:expat.h:没有这样的文件或目录。

    $ sudo apt-get install libexpat1-dev.

建议使用 -j3 参数,使编译速度更快。虽然也可以忽略。

$ make -j3
于 2018-07-23T04:54:41.920 回答
4

我是在 CentOS 中使用 pcre 编译 apache2 的另一个问题。我在其他位置“/custom/location/pcre”安装 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

于 2015-12-02T07:30:23.337 回答
1

RHEL 3中没有必要设置--with-pcre指向 pcre-config 的参数。只需要pcre路径

我的配置命令:

./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre
于 2015-05-12T11:52:55.310 回答
0

这对我有用

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

于 2017-12-05T13:11:55.923 回答
0

顺便说一句,在 CentOS 7.6 上构建 httpd 之前,请安装 pcre-devel

`$ sudo yum install pcre-devel` 
于 2019-04-16T10:34:38.923 回答