开发者社区> 问答> 正文

nginx 加入pcre库时编译错误?报错

在编译nginx时报错,那位帮忙看看 谢谢

make -f objs/Makefile
make[1]: Entering directory `/data/software/nginx-1.4.2'
cd /usr/local/pcre \
        && if [ -f Makefile ]; then make distclean; fi \
        && CC="cc" CFLAGS="-O2 -fomit-frame-pointer -pipe " \

cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/local/pcre -I objs \
                -o objs/src/core/nginx.o \
                src/core/nginx.c
在包含自 src/core/ngx_core.h:63 的文件中,
                 从 src/core/nginx.c:9:
src/core/ngx_regex.h:15:18: 错误:pcre.h:没有那个文件或目录
In file included from src/core/ngx_core.h:63,
                 from src/core/nginx.c:9:
src/core/ngx_regex.h:24: 错误:expected specifier-qualifier-list before ‘pcre’
make[1]: *** [objs/src/core/nginx.o] 错误 1
make[1]: Leaving directory `/data/software/nginx-1.4.2'
make: *** [build] 错误 2

展开
收起
爱吃鱼的程序员 2020-06-22 17:48:07 660 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    你的pcre库没有吧?编译的参数贴出来看看哦?非常感谢问题解决了,是没有pcre-devel库/usr/local/pcre存在吗,很多系统pcre都没有,要自己下载编译前把pcre的源码包解压出来,编译nginx时加入参数告知pere源码所在目录,例如:--with-pcre=/root/src/pcre-8.31/yuminstallprce-devel这个是重写模块必须的没有pcre可以在这里下载一个: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz ,编译时候把自己的pcre路径加上即可。或者直接yum-yinstallpcre-devel安装即可
    非常感谢各位的回答,当时只安装了pcre库,没安装pcre-devel问题解决了,谢谢各位

    --with-pcre=DIR是设置pcre的源码目录,而不是pcre的安装目录

    2020-06-22 17:48:25
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
《Nginx 代理系统常用手册》 立即下载
CentOS Nginx PHP JAVA 多语言镜像使用手 立即下载
CentOS Nginx PHP JAVA多语言镜像使用手册 立即下载