Linux 安装 PCRE 时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7866445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:50:04  来源:igfitidea点击:

Error installing PCRE

linuxgccubuntupcrelibtool

提问by Ohas

I'm trying to install PCRE on my Ubuntu 11.10 Server. When I run the "make" command, I get a really long output which always ends in this error:

我正在尝试在我的 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

I did run "configure". Any ideas?

我确实运行了“配置”。有任何想法吗?

采纳答案by Fredrik H??rd

You need a C++ compiler installed, you'll most likely want g++.

您需要安装 C++ 编译器,您很可能需要 g++。

With apt-get, run 'apt-get install g++', or 'apt-get install build-essential', since build-essential includes g++.

使用 apt-get,运行“apt-get install g++”或“apt-get install build-essential”,因为 build-essential 包括 g++。

回答by Yun Huang

Why not find PCRE using apt-cache search pcre | grep pcreand then use apt-get installto install PCRE? I think PCRE has been already included in the repository.

为什么不找到 PCRE usingapt-cache search pcre | grep pcre然后用它apt-get install来安装 PCRE?我认为 PCRE 已经包含在存储库中。

This is the result of the above command in my computer (Ubuntu 10.04):

这是在我的计算机(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

回答by JXPheonix

I found an answer as to why, but not a cure; (i know this is an old question but I thought I would contribute anyway).

我找到了原因的答案,但没有找到治愈方法;(我知道这是一个老问题,但我认为无论如何我都会做出贡献)。

I found pcre was already installed on my system, but apparently libtool was not. When I tried to sudo apt-get install libtool i got

我发现 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

Don't have much of an idea why this is happening, but working on finding out! Hopes this answers your question.

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

回答by BlackBear

I've had the same problem and the solution was to do everything suggested in the other answers andinstalling the developement files for PCRE:

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

  1. apt-get install build-essential
  2. apt-get install libtool
  3. apt-get install libpcre3-dev
  4. apt-get install libpcre3
  1. apt-get install build-essential
  2. apt-get 安装 libtool
  3. apt-get 安装 libpcre3-dev
  4. apt-get 安装 libpcre3

回答by XcodeJunkie

PCRE tries to build c++ output without having a c++ compiler. Try

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

./configure --disable-cpp 

to disable the C++ options.

禁用 C++ 选项。

回答by swapnil

To install pcrepackage, you need to run 2 commands:

要安装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
  1. apt-get install libpcre3 libpcre3-dev
  2. apt-get install build-essential libpcre3-dev libxslt1-dev libgd2-xpm-dev libgeoip-dev libssl-dev

回答by rogerdpack

When I run configure I get:

当我运行配置时,我得到:

libpcre checking for windows.h... no configure: error: Invalid C++ compiler or C++ compiler flags

libpcre 检查 windows.h... 没有配置:错误:无效的 C++ 编译器或 C++ 编译器标志

Fix was to install g++ as Fredrik mentioned. On CentOS: yum install gcc-c++

修复是按照 Fredrik 提到的那样安装 g++。在 CentOS 上:yum install gcc-c++