【问题标题】:Issue compiling nginx with pcre on ubuntu在 ubuntu 上使用 pcre 编译 nginx 的问题
【发布时间】:2013-02-16 00:41:11
【问题描述】:

我在 Ubuntu 12.04.1 LTS 上使用 PCRE 库构建 ngnix 时遇到问题。配置运行正常,但 make 命令失败。总的来说,我对 nginx 和 Linux 还很陌生,所以我不确定问题是什么。

安装步骤:

./configure --add-module=/home/ubuntu/mod_zip/mod_zip-master --with-http_image_filter_module --without-http_rewrite_module --with-pcre=../pcre-8.32
make
make install

错误

cd ../pcre-8.32 \
        && make libpcre.la
make[2]: Entering directory `/home/ubuntu/pcre-8.32'
  CC     libpcre_la-pcre_byte_order.lo
  CC     libpcre_la-pcre_compile.lo
  CC     libpcre_la-pcre_config.lo
  CC     libpcre_la-pcre_dfa_exec.lo
  CC     libpcre_la-pcre_exec.lo
  CC     libpcre_la-pcre_fullinfo.lo
  CC     libpcre_la-pcre_get.lo
  CC     libpcre_la-pcre_globals.lo
  CC     libpcre_la-pcre_jit_compile.lo
  CC     libpcre_la-pcre_maketables.lo
  CC     libpcre_la-pcre_newline.lo
  CC     libpcre_la-pcre_ord2utf8.lo
  CC     libpcre_la-pcre_refcount.lo
  CC     libpcre_la-pcre_string_utils.lo
  CC     libpcre_la-pcre_study.lo
  CC     libpcre_la-pcre_tables.lo
  CC     libpcre_la-pcre_ucd.lo
  CC     libpcre_la-pcre_valid_utf8.lo
  CC     libpcre_la-pcre_version.lo
  CC     libpcre_la-pcre_xclass.lo
rm -f pcre_chartables.c
ln -s ./pcre_chartables.c.dist pcre_chartables.c
  CC     libpcre_la-pcre_chartables.lo
  CCLD   libpcre.la
make[2]: Leaving directory `/home/ubuntu/pcre-8.32'
gcc -o objs/nginx \
        objs/src/core/nginx.o \
        objs/src/core/ngx_log.o \
        objs/src/core/ngx_palloc.o \
        objs/src/core/ngx_array.o \
        ...
        ...
        ...
        objs/addon/mod_zip-master/ngx_http_zip_module.o \
        objs/addon/mod_zip-master/ngx_http_zip_parsers.o \
        objs/addon/mod_zip-master/ngx_http_zip_file.o \
        objs/addon/mod_zip-master/ngx_http_zip_headers.o \
        objs/ngx_modules.o \
        -lpthread -lcrypt ../pcre-8.32/.libs/libpcre.a -lcrypto -lcrypto -lz -lgd
objs/src/core/nginx.o: In function `main':
/home/ubuntu/nginx-1.2.6/src/core/nginx.c:275: undefined reference to `ngx_regex_init'
objs/src/http/ngx_http_core_module.o: In function `ngx_http_gzip_disable':
/home/ubuntu/nginx-1.2.6/src/http/ngx_http_core_module.c:4918: undefined reference to `ngx_regex_compile'
objs/src/http/ngx_http_core_module.o: In function `ngx_http_gzip_ok':
/home/ubuntu/nginx-1.2.6/src/http/ngx_http_core_module.c:2218: undefined reference to `ngx_regex_exec_array'
objs/src/http/ngx_http_variables.o: In function `ngx_http_regex_compile':
/home/ubuntu/nginx-1.2.6/src/http/ngx_http_variables.c:2074: undefined reference to `ngx_regex_compile'
objs/src/http/modules/ngx_http_ssi_filter_module.o: In function `ngx_http_ssi_regex_match':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_ssi_filter_module.c:1882: undefined reference to `ngx_regex_compile'
objs/src/http/modules/ngx_http_referer_module.o: In function `ngx_http_referer_variable':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_referer_module.c:197: undefined reference to `ngx_regex_exec_array'
objs/src/http/modules/ngx_http_referer_module.o: In function `ngx_http_add_regex_referer':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_referer_module.c:582: undefined reference to `ngx_regex_compile'
objs/src/http/modules/ngx_http_fastcgi_module.o: In function `ngx_http_fastcgi_split_path_info':
/home/ubuntu/nginx-1.2.6/src/http/modules/ngx_http_fastcgi_module.c:2891: undefined reference to `ngx_regex_compile'
collect2: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/home/ubuntu/nginx-1.2.6'
make: *** [build] Error 2

谢谢!

【问题讨论】:

  • 我已尝试重现此问题,但失败了,因为根据您发布的输出,我无法理解该错误。您能否将整个输出和您的命令发布到 pastebin 之类的地方?

标签: nginx pcre


【解决方案1】:

您指定不使用 rewrite 模块,这意味着 Nginx 不需要 pcre。但随后您指定 pcre 位置。

我认为您应该删除 --with-pcre= 参数,然后就可以了。如果不使用 rewrite 模块,则无论如何都不需要 pcre。

【讨论】:

  • 我试图包含 pcre 的原因是它是在位置中使用正则表达式所必需的。
  • 尝试不禁用模组重写。我想那么它应该可以工作
猜你喜欢
  • 1970-01-01
  • 2012-08-03
  • 1970-01-01
  • 2019-12-08
  • 1970-01-01
  • 1970-01-01
  • 2020-07-21
  • 1970-01-01
  • 2014-05-11
相关资源
最近更新 更多