安装PCRE出错。

30

我正在尝试在我的Ubuntu 11.10服务器上安装PCRE。当我执行"make"命令时,会得到一长串输出,最后总是以以下错误结束:

libtool: link: ( cd ".libs" && rm -f "libpcreposix.la" && ln -s "../libpcreposix.la" "libpcreposix.la" ) source='pcrecpp.cc' object='pcrecpp.lo' libtool=yes \
        DEPDIR=.deps depmode=none /bin/bash ./depcomp \
        /bin/bash ./libtool --tag=CXX   --mode=compile  -DHAVE_CONFIG_H -I.      -c -o pcrecpp.lo pcrecpp.cc libtool: compile: unrecognized option `-DHAVE_CONFIG_H' libtool: compile: Try `libtool
--help' for more information. make[1]: *** [pcrecpp.lo] Error 1 make[1]: Leaving directory `/home/root/src/pcre/pcre-8.12' make:
*** [all] Error 2

我已经运行了 "configure"。有什么想法吗?


哪个 pcre?(tarball 的名称) - William Pursell
7个回答

26

您需要安装C++编译器,最好选择g++。

使用apt-get命令,运行'apt-get install g++',或者'apt-get install build-essential',因为build-essential包括g++。


实际上,${CXX} 在这里似乎已经扩展为空字符串。可以说,pcre 的配置应该捕捉到这一点 - 或者不尝试构建 pcrecpp。 - jørgensen
这样做对我来说并没有完全起作用。还是出现了相同的错误。我需要指定一些“configure”选项吗? - Ry-
@minitech 我不知道你是否尝试过,但是我安装了build-essential之后还是遇到了相同的错误。我所做的是删除pcre-8.31目录,然后重新解压缩,执行./configure命令,最后再编译,这样就成功了! - Philip
在安装新软件包失败后,清理一下是很好的习惯;通常使用“make clean”命令就可以解决问题。 - Fredrik Håård
1
我在安装过程中遇到了这个错误:https://bugzilla.redhat.com/show_bug.cgi?id=494006。运行yum clean metadata解决了这个错误,然后我成功安装了gcc-c++。 - yellavon
显示剩余2条评论

16

PCRE尝试在没有C++编译器的情况下构建C++输出。 请尝试:

./configure --disable-cpp 

禁用C++选项。


2
如果使用 --without-pgsql 禁用了 cpp,会有什么影响吗? - GoinOff

8
为什么不使用“apt-cache search pcre | grep pcre”查找PCRE,然后使用“apt-get install”安装PCRE呢?我认为PCRE已经包含在存储库中了。
这是我电脑(Ubuntu 10.04)上面命令的结果:
$ apt-cache search pcre | grep pcre
libpcre3-dbg - Perl 5 Compatible Regular Expression Library - debug symbols
libpcre3-dev - Perl 5 Compatible Regular Expression Library - development files
libpcrecpp0 - Perl 5 Compatible Regular Expression Library - C++ runtime files
libpcre3 - Perl 5 Compatible Regular Expression Library - runtime files
cl-ppcre - Portable Regular Express Library for Common Lisp
gambas2-gb-pcre - The Gambas regexp component
haskell-pcre-light-doc - library documentation for pcre-light
libghc6-pcre-light-dev - Haskell library for Perl 5-compatible regular expressions
libghc6-pcre-light-prof - pcre-light library with profiling enabled
liblua5.1-rex-pcre-dev - PCRE development files for the Lua language version 5.1
liblua5.1-rex-pcre0 - Perl regular expressions library for the Lua language version 5.1
libpcre++-dev - C++ wrapper class for pcre (development)
libpcre++0 - C++ wrapper class for pcre (runtime)
libpcre-ocaml - OCaml bindings for PCRE (runtime)
libpcre-ocaml-dev - OCaml bindings for PCRE (Perl Compatible Regular Expression)
pcregrep - grep utility that uses perl 5 compatible regexes.
pike7.6-pcre - PCRE module for Pike
sqlite3-pcre - Perl-compatible regular expression support for SQLite
postfix-pcre - PCRE map support for Postfix

1
人们正在尝试安装版本8。TheBuggenie使用pcre版本8,天知道为什么他们会使用这样的东西,这使得开始使用他们的产品变得不可能。安装TheBuggenie非常痛苦。 - Siddharth

8

我曾经遇到过同样的问题,解决方案是执行其他答案中建议的所有操作 安装PCRE的开发文件:

  1. apt-get install build-essential(安装构建必备工具)
  2. apt-get install libtool(安装libtool)
  3. apt-get install libpcre3-dev(安装PCRE开发文件)
  4. apt-get install libpcre3(安装PCRE库)

6
当我运行 configure 命令时,出现以下错误信息: libpcre 检查 windows.h 时未通过,报错:无效的 C++ 编译器或 C++ 编译器标志。
解决方法是安装 g++,如 Fredrik 所提到的。在 CentOS 上可以使用以下命令进行安装:yum install gcc-c++

1
要安装pcre软件包,您需要运行2个命令:
  1. apt-get install libpcre3 libpcre3-dev
  2. apt-get install build-essential libpcre3-dev libxslt1-dev libgd2-xpm-dev libgeoip-dev libssl-dev

你好!在这里,非常简短的答案通常会受到负面评价。如果你能够让你的回答更加详细,你就会开始得到赞同。 - user6820627

0
我找到了关于为什么的答案,但没有找到解决方法;(我知道这是一个老问题,但我还是想做出贡献)。
我发现 pcre 已经安装在我的系统上了,但显然 libtool 没有。当我尝试运行 sudo apt-get install libtool 时,我遇到了以下错误:
Package libtool is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

目前还不太清楚为什么会发生这种情况,但正在努力找出原因!希望这回答了你的问题。


https://askubuntu.com/q/391184/20972 可能会有所帮助,但建议将其作为一个全新的问题提出。 - rogerdpack

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接