php 错误构建:致命错误:pcre.h:没有这样的文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22555561/
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
Error building : fatal error: pcre.h: No such file or directory
提问by fabrice
I'm just finished installing Ubuntu 13.10.
我刚刚完成安装 Ubuntu 13.10。
I want try Phalcon, and when I build the source (phalcon.so), I have this error :
我想尝试 Phalcon,当我构建源代码 (phalcon.so) 时,出现以下错误:
from /home/fabrice/Downloads/cphalcon/build/32bits/phalcon.c:204:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
#include "pcre.h"
^
compilation terminated.
make: *** [phalcon.lo] Erreur 1
My installation of lamp is :
我的灯安装是:
sudo apt-get install -y apache2 php5 mysql-server libapache2-mod-php5 php5-mysql php5-curl php5-imagick php5-mcrypt php5-memcache php5-sqlite php5-xdebug php-apc php5-intl php-mongo php5-dev gcc
sudo apt-get install -y apache2 php5 mysql-server libapache2-mod-php5 php5-mysql php5-curl php5-imagick php5-mcrypt php5-memcache php5-sqlite php5-xdebug php-apc php5-intl php-mongo php5-dev海湾合作委员会
Can anybody help me ?
有谁能够帮助我 ?
回答by Nikolaos Dimopoulos
The latest version of Phalcon uses PCRE libraries.
最新版本的 Phalcon 使用 PCRE 库。
You can install them like so:
您可以像这样安装它们:
sudo apt-get install libpcre3-dev
and then try and install Phalcon again
然后再次尝试安装 Phalcon
For CentOS you will need to use
对于 CentOS,您需要使用
sudo yum install pcre-devel
Credits: @xgretsch
学分:@ xgretsch
For Mac you can use
对于 Mac,您可以使用
brew install pcre
Credits @Brandon Romano
积分@布兰登罗马诺
For Mac without brew
对于 Mac 没有 brew
Go to https://www.pcre.org/and download latest pcre:,
转到https://www.pcre.org/并下载最新的 pcre:,
tar -xzvf pcre-8.42.tar.gz
cd pcre-8.42
./configure --prefix=/usr/local/pcre-8.42
make
make install
ln -s /usr/local/pcre-8.42 /usr/sbin/pcre
ln -s /usr/local/pcre-8.42/include/pcre.h /usr/include/pcre.h
Credits @user1377324
积分@ user1377324
回答by stackMonk
To include pcre.h file, search the package archives for the pcre.h file. To do this I use a command called apt-file (
要包含 pcre.h 文件,请在包档案中搜索 pcre.h 文件。为此,我使用了一个名为 apt-file (
apt-get install apt-file
apt-get 安装 apt 文件
and
和
apt-file update
apt 文件更新
if you don't have it installed).
如果你没有安装它)。
Then search for the pcre package:
然后搜索pcre包:
apt-file search -x "/pcre.h$"
apt-file search -x "/pcre.h$"
The -x informs the command that I want to use a regular expression as the pattern. apt-file provided me with three hits:
-x 通知命令我想使用正则表达式作为模式。apt-file 为我提供了三个点击:
- kannel-dev: /usr/include/kannel/gwlib/pcre.h
- libajax6-dev: /usr/include/ajax/pcre.h
- libpcre3-dev: /usr/include/pcre.h
- kannel-dev: /usr/include/kannel/gwlib/pcre.h
- libajax6-dev:/usr/include/ajax/pcre.h
- libpcre3-dev:/usr/include/pcre.h
The last one is the one I want:
最后一个是我想要的:
apt-get install libpcre3-dev
apt-get 安装 libpcre3-dev
This will solve the problem with pcre.h file compilation problem. Hope it will help others, who may come to find an answer to this thread.
这将解决 pcre.h 文件编译问题。希望它会帮助其他人,他们可能会找到这个线程的答案。
回答by Astm
For mac osx maverick you can use
对于 mac osx 特立独行,您可以使用
brew install pcre
if it gives you error, you can use
如果它给你错误,你可以使用
sudo ln -s /opt/local/include/pcre.h /usr/include/
sudo pecl install apc