在 Windows 上使用 PCRE 构建 nginx 在 nginx.exe 的 link 步骤上失败
Building nginx with PCRE on Windows fails on link step for nginx.exe
我正在尝试在 Windows 上编译支持 PCRE 的 nginx。
我的构建脚本是用bash:
写的
curl -O https://ftp.pcre.org/pub/pcre/pcre-8.00.zip
unzip -qd pcre-8.00 pcre-8.00.zip
rm -f pcre-8.00.zip
# For brevity, I'm leaving out how openssl is pulled
pushd openssl
cmd //c 'mklink /j openssl .'
popd
pushd nginx
auto/configure \
--without-http_autoindex_module \
--without-http_charset_module \
--without-http_empty_gif_module \
--without-http_rewrite_module \
--without-http_scgi_module \
--without-http_uwsgi_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-http_stub_status_module \
--with-openssl=../openssl \
--crossbuild=win32 \
--with-select_module \
--with-cc=cl \
--builddir=objs \
--prefix= \
--conf-path=conf/nginx.conf \
--error-log-path=logs/error.log \
--http-log-path=logs/access.log \
--pid-path=logs/nginx.pid \
--sbin-path=nginx.exe \
--http-client-body-temp-path=temp/client_body_temp \
--http-proxy-temp-path=temp/proxy_temp \
--http-fastcgi-temp-path=temp/fastcgi_temp \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=../pcre-8.00/pcre-8.00 \
--with-zlib=../zlib
nmake -f objs/Makefile
popd
auto/configure
命令运行成功,输出如下:
building for win32
+ using Microsoft Visual C++ compiler
+ cl version: 19.00.24215.1 for x64
checking for win32 specific features
creating objs/Makefile
Configuration summary
+ using PCRE library: ../pcre-8.00/pcre-8.00
+ using OpenSSL library: ../openssl
+ using zlib library: ../zlib
nginx path prefix: ""
nginx binary file: "/nginx.exe"
nginx modules path: "/modules"
nginx configuration prefix: "/conf"
nginx configuration file: "/conf/nginx.conf"
nginx pid file: "/logs/nginx.pid"
nginx error log file: "/logs/error.log"
nginx http access log file: "/logs/access.log"
nginx http client request body temporary files: "temp/client_body_temp"
nginx http proxy temporary files: "temp/proxy_temp"
nginx http fastcgi temporary files: "temp/fastcgi_temp"
然而,实际构建在尝试生成 nginx.exe
时失败并出现“未解决的外部符号错误”。这是带有错误的构建输出部分:
nginx.obj : error LNK2019: unresolved external symbol ngx_regex_init referenced in function main
ngx_http_fastcgi_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_stream_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_ssi_filter_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2019: unresolved external symbol ngx_regex_exec_array referenced in function ngx_http_gzip_ok
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_exec_array
objs/nginx.exe : fatal error LNK1120: 3 unresolved externals
任意选择一个未解析的符号,ngx_regex_init
定义在ngx_regex.c
中。查看auto
directory of the nginx source code, I found that ngx_regex.c
is only added to the source files that are compiled if $USEPCRE = YES
. Here is the code in particular (and a link to the source):
中的代码
if [ $USE_PCRE = YES ]; then
ngx_module_type=CORE
ngx_module_name=ngx_regex_module
ngx_module_incs=
ngx_module_deps=src/core/ngx_regex.h
ngx_module_srcs=src/core/ngx_regex.c
ngx_module_libs=
ngx_module_link=YES
ngx_module_order=
. auto/module
fi
为什么 $USE_PCRE
不是 YES
,因为我使用的是 --with-pcre
标志?
为确保我没有提供信息失败,这里是完整的 cl
命令(由 nmake Makefile 发出)及其输出:
cl -Feobjs/nginx.exe
objs/src/core/nginx.obj
objs/src/core/ngx_log.obj
objs/src/core/ngx_palloc.obj
objs/src/core/ngx_array.obj
objs/src/core/ngx_list.obj
objs/src/core/ngx_hash.obj
objs/src/core/ngx_buf.obj
objs/src/core/ngx_queue.obj
objs/src/core/ngx_output_chain.obj
objs/src/core/ngx_string.obj
objs/src/core/ngx_parse.obj
objs/src/core/ngx_parse_time.obj
objs/src/core/ngx_inet.obj
objs/src/core/ngx_file.obj
objs/src/core/ngx_crc32.obj
objs/src/core/ngx_murmurhash.obj
objs/src/core/ngx_md5.obj
objs/src/core/ngx_sha1.obj
objs/src/core/ngx_rbtree.obj
objs/src/core/ngx_radix_tree.obj
objs/src/core/ngx_slab.obj
objs/src/core/ngx_times.obj
objs/src/core/ngx_shmtx.obj
objs/src/core/ngx_connection.obj
objs/src/core/ngx_cycle.obj
objs/src/core/ngx_spinlock.obj
objs/src/core/ngx_rwlock.obj
objs/src/core/ngx_cpuinfo.obj
objs/src/core/ngx_conf_file.obj
objs/src/core/ngx_module.obj
objs/src/core/ngx_resolver.obj
objs/src/core/ngx_open_file_cache.obj
objs/src/core/ngx_crypt.obj
objs/src/core/ngx_proxy_protocol.obj
objs/src/core/ngx_syslog.obj
objs/src/event/ngx_event.obj
objs/src/event/ngx_event_timer.obj
objs/src/event/ngx_event_posted.obj
objs/src/event/ngx_event_accept.obj
objs/src/event/ngx_event_udp.obj
objs/src/event/ngx_event_connect.obj
objs/src/event/ngx_event_pipe.obj
objs/src/os/win32/ngx_errno.obj
objs/src/os/win32/ngx_alloc.obj
objs/src/os/win32/ngx_files.obj
objs/src/os/win32/ngx_shmem.obj
objs/src/os/win32/ngx_time.obj
objs/src/os/win32/ngx_process.obj
objs/src/os/win32/ngx_thread.obj
objs/src/os/win32/ngx_socket.obj
objs/src/os/win32/ngx_wsarecv.obj
objs/src/os/win32/ngx_wsarecv_chain.obj
objs/src/os/win32/ngx_udp_wsarecv.obj
objs/src/os/win32/ngx_wsasend.obj
objs/src/os/win32/ngx_wsasend_chain.obj
objs/src/os/win32/ngx_win32_init.obj
objs/src/os/win32/ngx_user.obj
objs/src/os/win32/ngx_dlopen.obj
objs/src/os/win32/ngx_event_log.obj
objs/src/os/win32/ngx_process_cycle.obj
objs/src/event/ngx_event_acceptex.obj
objs/src/event/modules/ngx_iocp_module.obj
objs/src/event/modules/ngx_win32_select_module.obj
objs/src/event/modules/ngx_win32_poll_module.obj
objs/src/event/ngx_event_openssl.obj
objs/src/event/ngx_event_openssl_stapling.obj
objs/src/http/ngx_http.obj
objs/src/http/ngx_http_core_module.obj
objs/src/http/ngx_http_special_response.obj
objs/src/http/ngx_http_request.obj
objs/src/http/ngx_http_parse.obj
objs/src/http/modules/ngx_http_log_module.obj
objs/src/http/ngx_http_request_body.obj
objs/src/http/ngx_http_variables.obj
objs/src/http/ngx_http_script.obj
objs/src/http/ngx_http_upstream.obj
objs/src/http/ngx_http_upstream_round_robin.obj
objs/src/http/ngx_http_file_cache.obj
objs/src/http/ngx_http_write_filter_module.obj
objs/src/http/ngx_http_header_filter_module.obj
objs/src/http/modules/ngx_http_chunked_filter_module.obj
objs/src/http/v2/ngx_http_v2_filter_module.obj
objs/src/http/modules/ngx_http_range_filter_module.obj
objs/src/http/modules/ngx_http_gzip_filter_module.obj
objs/src/http/ngx_http_postpone_filter_module.obj
objs/src/http/modules/ngx_http_ssi_filter_module.obj
objs/src/http/modules/ngx_http_userid_filter_module.obj
objs/src/http/modules/ngx_http_headers_filter_module.obj
objs/src/http/ngx_http_copy_filter_module.obj
objs/src/http/modules/ngx_http_not_modified_filter_module.obj
objs/src/http/v2/ngx_http_v2.obj
objs/src/http/v2/ngx_http_v2_table.obj
objs/src/http/v2/ngx_http_v2_encode.obj
objs/src/http/v2/ngx_http_v2_huff_decode.obj
objs/src/http/v2/ngx_http_v2_huff_encode.obj
objs/src/http/v2/ngx_http_v2_module.obj
objs/src/http/modules/ngx_http_static_module.obj
objs/src/http/modules/ngx_http_index_module.obj
objs/src/http/modules/ngx_http_mirror_module.obj
objs/src/http/modules/ngx_http_try_files_module.obj
objs/src/http/modules/ngx_http_auth_basic_module.obj
objs/src/http/modules/ngx_http_access_module.obj
objs/src/http/modules/ngx_http_limit_conn_module.obj
objs/src/http/modules/ngx_http_limit_req_module.obj
objs/src/http/modules/ngx_http_geo_module.obj
objs/src/http/modules/ngx_http_map_module.obj
objs/src/http/modules/ngx_http_split_clients_module.obj
objs/src/http/modules/ngx_http_referer_module.obj
objs/src/http/modules/ngx_http_ssl_module.obj
objs/src/http/modules/ngx_http_proxy_module.obj
objs/src/http/modules/ngx_http_fastcgi_module.obj
objs/src/http/modules/ngx_http_grpc_module.obj
objs/src/http/modules/ngx_http_memcached_module.obj
objs/src/http/modules/ngx_http_browser_module.obj
objs/src/http/modules/ngx_http_upstream_hash_module.obj
objs/src/http/modules/ngx_http_upstream_ip_hash_module.obj
objs/src/http/modules/ngx_http_upstream_least_conn_module.obj
objs/src/http/modules/ngx_http_upstream_random_module.obj
objs/src/http/modules/ngx_http_upstream_keepalive_module.obj
objs/src/http/modules/ngx_http_upstream_zone_module.obj
objs/src/http/modules/ngx_http_stub_status_module.obj
objs/src/stream/ngx_stream.obj
objs/src/stream/ngx_stream_variables.obj
objs/src/stream/ngx_stream_script.obj
objs/src/stream/ngx_stream_handler.obj
objs/src/stream/ngx_stream_core_module.obj
objs/src/stream/ngx_stream_log_module.obj
objs/src/stream/ngx_stream_proxy_module.obj
objs/src/stream/ngx_stream_upstream.obj
objs/src/stream/ngx_stream_upstream_round_robin.obj
objs/src/stream/ngx_stream_write_filter_module.obj
objs/src/stream/ngx_stream_ssl_module.obj
objs/src/stream/ngx_stream_limit_conn_module.obj
objs/src/stream/ngx_stream_access_module.obj
objs/src/stream/ngx_stream_geo_module.obj
objs/src/stream/ngx_stream_map_module.obj
objs/src/stream/ngx_stream_split_clients_module.obj
objs/src/stream/ngx_stream_return_module.obj
objs/src/stream/ngx_stream_set_module.obj
objs/src/stream/ngx_stream_upstream_hash_module.obj
objs/src/stream/ngx_stream_upstream_least_conn_module.obj
objs/src/stream/ngx_stream_upstream_random_module.obj
objs/src/stream/ngx_stream_upstream_zone_module.obj
objs/src/stream/ngx_stream_ssl_preread_module.obj
objs/ngx_modules.obj
kernel32.lib user32.lib advapi32.lib ws2_32.lib ../pcre-8.00/pcre-8.00/pcre.lib ../openssl/openssl/lib/ssleay32.lib ../openssl/openssl/lib/libeay32.lib gdi32.lib crypt32.lib ../zlib/zlib.lib
objs/nginx.res -link -verbose:lib -debug objs/ngx_pch.obj
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:objs/nginx.exe
-verbose:lib
-debug
objs/ngx_pch.obj
objs/src/core/nginx.obj
objs/src/core/ngx_log.obj
objs/src/core/ngx_palloc.obj
objs/src/core/ngx_array.obj
objs/src/core/ngx_list.obj
objs/src/core/ngx_hash.obj
objs/src/core/ngx_buf.obj
objs/src/core/ngx_queue.obj
objs/src/core/ngx_output_chain.obj
objs/src/core/ngx_string.obj
objs/src/core/ngx_parse.obj
objs/src/core/ngx_parse_time.obj
objs/src/core/ngx_inet.obj
objs/src/core/ngx_file.obj
objs/src/core/ngx_crc32.obj
objs/src/core/ngx_murmurhash.obj
objs/src/core/ngx_md5.obj
objs/src/core/ngx_sha1.obj
objs/src/core/ngx_rbtree.obj
objs/src/core/ngx_radix_tree.obj
objs/src/core/ngx_slab.obj
objs/src/core/ngx_times.obj
objs/src/core/ngx_shmtx.obj
objs/src/core/ngx_connection.obj
objs/src/core/ngx_cycle.obj
objs/src/core/ngx_spinlock.obj
objs/src/core/ngx_rwlock.obj
objs/src/core/ngx_cpuinfo.obj
objs/src/core/ngx_conf_file.obj
objs/src/core/ngx_module.obj
objs/src/core/ngx_resolver.obj
objs/src/core/ngx_open_file_cache.obj
objs/src/core/ngx_crypt.obj
objs/src/core/ngx_proxy_protocol.obj
objs/src/core/ngx_syslog.obj
objs/src/event/ngx_event.obj
objs/src/event/ngx_event_timer.obj
objs/src/event/ngx_event_posted.obj
objs/src/event/ngx_event_accept.obj
objs/src/event/ngx_event_udp.obj
objs/src/event/ngx_event_connect.obj
objs/src/event/ngx_event_pipe.obj
objs/src/os/win32/ngx_errno.obj
objs/src/os/win32/ngx_alloc.obj
objs/src/os/win32/ngx_files.obj
objs/src/os/win32/ngx_shmem.obj
objs/src/os/win32/ngx_time.obj
objs/src/os/win32/ngx_process.obj
objs/src/os/win32/ngx_thread.obj
objs/src/os/win32/ngx_socket.obj
objs/src/os/win32/ngx_wsarecv.obj
objs/src/os/win32/ngx_wsarecv_chain.obj
objs/src/os/win32/ngx_udp_wsarecv.obj
objs/src/os/win32/ngx_wsasend.obj
objs/src/os/win32/ngx_wsasend_chain.obj
objs/src/os/win32/ngx_win32_init.obj
objs/src/os/win32/ngx_user.obj
objs/src/os/win32/ngx_dlopen.obj
objs/src/os/win32/ngx_event_log.obj
objs/src/os/win32/ngx_process_cycle.obj
objs/src/event/ngx_event_acceptex.obj
objs/src/event/modules/ngx_iocp_module.obj
objs/src/event/modules/ngx_win32_select_module.obj
objs/src/event/modules/ngx_win32_poll_module.obj
objs/src/event/ngx_event_openssl.obj
objs/src/event/ngx_event_openssl_stapling.obj
objs/src/http/ngx_http.obj
objs/src/http/ngx_http_core_module.obj
objs/src/http/ngx_http_special_response.obj
objs/src/http/ngx_http_request.obj
objs/src/http/ngx_http_parse.obj
objs/src/http/modules/ngx_http_log_module.obj
objs/src/http/ngx_http_request_body.obj
objs/src/http/ngx_http_variables.obj
objs/src/http/ngx_http_script.obj
objs/src/http/ngx_http_upstream.obj
objs/src/http/ngx_http_upstream_round_robin.obj
objs/src/http/ngx_http_file_cache.obj
objs/src/http/ngx_http_write_filter_module.obj
objs/src/http/ngx_http_header_filter_module.obj
objs/src/http/modules/ngx_http_chunked_filter_module.obj
objs/src/http/v2/ngx_http_v2_filter_module.obj
objs/src/http/modules/ngx_http_range_filter_module.obj
objs/src/http/modules/ngx_http_gzip_filter_module.obj
objs/src/http/ngx_http_postpone_filter_module.obj
objs/src/http/modules/ngx_http_ssi_filter_module.obj
objs/src/http/modules/ngx_http_userid_filter_module.obj
objs/src/http/modules/ngx_http_headers_filter_module.obj
objs/src/http/ngx_http_copy_filter_module.obj
objs/src/http/modules/ngx_http_not_modified_filter_module.obj
objs/src/http/v2/ngx_http_v2.obj
objs/src/http/v2/ngx_http_v2_table.obj
objs/src/http/v2/ngx_http_v2_encode.obj
objs/src/http/v2/ngx_http_v2_huff_decode.obj
objs/src/http/v2/ngx_http_v2_huff_encode.obj
objs/src/http/v2/ngx_http_v2_module.obj
objs/src/http/modules/ngx_http_static_module.obj
objs/src/http/modules/ngx_http_index_module.obj
objs/src/http/modules/ngx_http_mirror_module.obj
objs/src/http/modules/ngx_http_try_files_module.obj
objs/src/http/modules/ngx_http_auth_basic_module.obj
objs/src/http/modules/ngx_http_access_module.obj
objs/src/http/modules/ngx_http_limit_conn_module.obj
objs/src/http/modules/ngx_http_limit_req_module.obj
objs/src/http/modules/ngx_http_geo_module.obj
objs/src/http/modules/ngx_http_map_module.obj
objs/src/http/modules/ngx_http_split_clients_module.obj
objs/src/http/modules/ngx_http_referer_module.obj
objs/src/http/modules/ngx_http_ssl_module.obj
objs/src/http/modules/ngx_http_proxy_module.obj
objs/src/http/modules/ngx_http_fastcgi_module.obj
objs/src/http/modules/ngx_http_grpc_module.obj
objs/src/http/modules/ngx_http_memcached_module.obj
objs/src/http/modules/ngx_http_browser_module.obj
objs/src/http/modules/ngx_http_upstream_hash_module.obj
objs/src/http/modules/ngx_http_upstream_ip_hash_module.obj
objs/src/http/modules/ngx_http_upstream_least_conn_module.obj
objs/src/http/modules/ngx_http_upstream_random_module.obj
objs/src/http/modules/ngx_http_upstream_keepalive_module.obj
objs/src/http/modules/ngx_http_upstream_zone_module.obj
objs/src/http/modules/ngx_http_stub_status_module.obj
objs/src/stream/ngx_stream.obj
objs/src/stream/ngx_stream_variables.obj
objs/src/stream/ngx_stream_script.obj
objs/src/stream/ngx_stream_handler.obj
objs/src/stream/ngx_stream_core_module.obj
objs/src/stream/ngx_stream_log_module.obj
objs/src/stream/ngx_stream_proxy_module.obj
objs/src/stream/ngx_stream_upstream.obj
objs/src/stream/ngx_stream_upstream_round_robin.obj
objs/src/stream/ngx_stream_write_filter_module.obj
objs/src/stream/ngx_stream_ssl_module.obj
objs/src/stream/ngx_stream_limit_conn_module.obj
objs/src/stream/ngx_stream_access_module.obj
objs/src/stream/ngx_stream_geo_module.obj
objs/src/stream/ngx_stream_map_module.obj
objs/src/stream/ngx_stream_split_clients_module.obj
objs/src/stream/ngx_stream_return_module.obj
objs/src/stream/ngx_stream_set_module.obj
objs/src/stream/ngx_stream_upstream_hash_module.obj
objs/src/stream/ngx_stream_upstream_least_conn_module.obj
objs/src/stream/ngx_stream_upstream_random_module.obj
objs/src/stream/ngx_stream_upstream_zone_module.obj
objs/src/stream/ngx_stream_ssl_preread_module.obj
objs/ngx_modules.obj
kernel32.lib
user32.lib
advapi32.lib
ws2_32.lib
../pcre-8.00/pcre-8.00/pcre.lib
../openssl/openssl/lib/ssleay32.lib
../openssl/openssl/lib/libeay32.lib
gdi32.lib
crypt32.lib
../zlib/zlib.lib
objs/nginx.res
Searching libraries
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\lib.0.14393.0\ucrt\x64\libucrt.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\lib.0.14393.0\ucrt\x64\libucrt.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Finished searching libraries
Searching libraries
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\lib.0.14393.0\ucrt\x64\libucrt.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\uuid.lib:
Finished searching libraries
nginx.obj : error LNK2019: unresolved external symbol ngx_regex_init referenced in function main
ngx_http_fastcgi_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_stream_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_ssi_filter_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2019: unresolved external symbol ngx_regex_exec_array referenced in function ngx_http_gzip_ok
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_exec_array
objs/nginx.exe : fatal error LNK1120: 3 unresolved externals
事实证明,如果 http_rewrite
模块未被禁用且使用 PCRE 未被禁用,则 USE_PCRE
仅设置为 YES
。您可以在代码 here:
中看到这一点
if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then
USE_PCRE=YES
# ...
fi
一旦我从 auto/configure
命令中删除了 --without-http_rewrite_module
选项,nginx 和 PCRE 就可以正常构建了。
我正在尝试在 Windows 上编译支持 PCRE 的 nginx。
我的构建脚本是用bash:
写的curl -O https://ftp.pcre.org/pub/pcre/pcre-8.00.zip
unzip -qd pcre-8.00 pcre-8.00.zip
rm -f pcre-8.00.zip
# For brevity, I'm leaving out how openssl is pulled
pushd openssl
cmd //c 'mklink /j openssl .'
popd
pushd nginx
auto/configure \
--without-http_autoindex_module \
--without-http_charset_module \
--without-http_empty_gif_module \
--without-http_rewrite_module \
--without-http_scgi_module \
--without-http_uwsgi_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--with-stream_ssl_preread_module \
--with-http_stub_status_module \
--with-openssl=../openssl \
--crossbuild=win32 \
--with-select_module \
--with-cc=cl \
--builddir=objs \
--prefix= \
--conf-path=conf/nginx.conf \
--error-log-path=logs/error.log \
--http-log-path=logs/access.log \
--pid-path=logs/nginx.pid \
--sbin-path=nginx.exe \
--http-client-body-temp-path=temp/client_body_temp \
--http-proxy-temp-path=temp/proxy_temp \
--http-fastcgi-temp-path=temp/fastcgi_temp \
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=../pcre-8.00/pcre-8.00 \
--with-zlib=../zlib
nmake -f objs/Makefile
popd
auto/configure
命令运行成功,输出如下:
building for win32
+ using Microsoft Visual C++ compiler
+ cl version: 19.00.24215.1 for x64
checking for win32 specific features
creating objs/Makefile
Configuration summary
+ using PCRE library: ../pcre-8.00/pcre-8.00
+ using OpenSSL library: ../openssl
+ using zlib library: ../zlib
nginx path prefix: ""
nginx binary file: "/nginx.exe"
nginx modules path: "/modules"
nginx configuration prefix: "/conf"
nginx configuration file: "/conf/nginx.conf"
nginx pid file: "/logs/nginx.pid"
nginx error log file: "/logs/error.log"
nginx http access log file: "/logs/access.log"
nginx http client request body temporary files: "temp/client_body_temp"
nginx http proxy temporary files: "temp/proxy_temp"
nginx http fastcgi temporary files: "temp/fastcgi_temp"
然而,实际构建在尝试生成 nginx.exe
时失败并出现“未解决的外部符号错误”。这是带有错误的构建输出部分:
nginx.obj : error LNK2019: unresolved external symbol ngx_regex_init referenced in function main
ngx_http_fastcgi_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_stream_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_ssi_filter_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2019: unresolved external symbol ngx_regex_exec_array referenced in function ngx_http_gzip_ok
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_exec_array
objs/nginx.exe : fatal error LNK1120: 3 unresolved externals
任意选择一个未解析的符号,ngx_regex_init
定义在ngx_regex.c
中。查看auto
directory of the nginx source code, I found that ngx_regex.c
is only added to the source files that are compiled if $USEPCRE = YES
. Here is the code in particular (and a link to the source):
if [ $USE_PCRE = YES ]; then
ngx_module_type=CORE
ngx_module_name=ngx_regex_module
ngx_module_incs=
ngx_module_deps=src/core/ngx_regex.h
ngx_module_srcs=src/core/ngx_regex.c
ngx_module_libs=
ngx_module_link=YES
ngx_module_order=
. auto/module
fi
为什么 $USE_PCRE
不是 YES
,因为我使用的是 --with-pcre
标志?
为确保我没有提供信息失败,这里是完整的 cl
命令(由 nmake Makefile 发出)及其输出:
cl -Feobjs/nginx.exe
objs/src/core/nginx.obj
objs/src/core/ngx_log.obj
objs/src/core/ngx_palloc.obj
objs/src/core/ngx_array.obj
objs/src/core/ngx_list.obj
objs/src/core/ngx_hash.obj
objs/src/core/ngx_buf.obj
objs/src/core/ngx_queue.obj
objs/src/core/ngx_output_chain.obj
objs/src/core/ngx_string.obj
objs/src/core/ngx_parse.obj
objs/src/core/ngx_parse_time.obj
objs/src/core/ngx_inet.obj
objs/src/core/ngx_file.obj
objs/src/core/ngx_crc32.obj
objs/src/core/ngx_murmurhash.obj
objs/src/core/ngx_md5.obj
objs/src/core/ngx_sha1.obj
objs/src/core/ngx_rbtree.obj
objs/src/core/ngx_radix_tree.obj
objs/src/core/ngx_slab.obj
objs/src/core/ngx_times.obj
objs/src/core/ngx_shmtx.obj
objs/src/core/ngx_connection.obj
objs/src/core/ngx_cycle.obj
objs/src/core/ngx_spinlock.obj
objs/src/core/ngx_rwlock.obj
objs/src/core/ngx_cpuinfo.obj
objs/src/core/ngx_conf_file.obj
objs/src/core/ngx_module.obj
objs/src/core/ngx_resolver.obj
objs/src/core/ngx_open_file_cache.obj
objs/src/core/ngx_crypt.obj
objs/src/core/ngx_proxy_protocol.obj
objs/src/core/ngx_syslog.obj
objs/src/event/ngx_event.obj
objs/src/event/ngx_event_timer.obj
objs/src/event/ngx_event_posted.obj
objs/src/event/ngx_event_accept.obj
objs/src/event/ngx_event_udp.obj
objs/src/event/ngx_event_connect.obj
objs/src/event/ngx_event_pipe.obj
objs/src/os/win32/ngx_errno.obj
objs/src/os/win32/ngx_alloc.obj
objs/src/os/win32/ngx_files.obj
objs/src/os/win32/ngx_shmem.obj
objs/src/os/win32/ngx_time.obj
objs/src/os/win32/ngx_process.obj
objs/src/os/win32/ngx_thread.obj
objs/src/os/win32/ngx_socket.obj
objs/src/os/win32/ngx_wsarecv.obj
objs/src/os/win32/ngx_wsarecv_chain.obj
objs/src/os/win32/ngx_udp_wsarecv.obj
objs/src/os/win32/ngx_wsasend.obj
objs/src/os/win32/ngx_wsasend_chain.obj
objs/src/os/win32/ngx_win32_init.obj
objs/src/os/win32/ngx_user.obj
objs/src/os/win32/ngx_dlopen.obj
objs/src/os/win32/ngx_event_log.obj
objs/src/os/win32/ngx_process_cycle.obj
objs/src/event/ngx_event_acceptex.obj
objs/src/event/modules/ngx_iocp_module.obj
objs/src/event/modules/ngx_win32_select_module.obj
objs/src/event/modules/ngx_win32_poll_module.obj
objs/src/event/ngx_event_openssl.obj
objs/src/event/ngx_event_openssl_stapling.obj
objs/src/http/ngx_http.obj
objs/src/http/ngx_http_core_module.obj
objs/src/http/ngx_http_special_response.obj
objs/src/http/ngx_http_request.obj
objs/src/http/ngx_http_parse.obj
objs/src/http/modules/ngx_http_log_module.obj
objs/src/http/ngx_http_request_body.obj
objs/src/http/ngx_http_variables.obj
objs/src/http/ngx_http_script.obj
objs/src/http/ngx_http_upstream.obj
objs/src/http/ngx_http_upstream_round_robin.obj
objs/src/http/ngx_http_file_cache.obj
objs/src/http/ngx_http_write_filter_module.obj
objs/src/http/ngx_http_header_filter_module.obj
objs/src/http/modules/ngx_http_chunked_filter_module.obj
objs/src/http/v2/ngx_http_v2_filter_module.obj
objs/src/http/modules/ngx_http_range_filter_module.obj
objs/src/http/modules/ngx_http_gzip_filter_module.obj
objs/src/http/ngx_http_postpone_filter_module.obj
objs/src/http/modules/ngx_http_ssi_filter_module.obj
objs/src/http/modules/ngx_http_userid_filter_module.obj
objs/src/http/modules/ngx_http_headers_filter_module.obj
objs/src/http/ngx_http_copy_filter_module.obj
objs/src/http/modules/ngx_http_not_modified_filter_module.obj
objs/src/http/v2/ngx_http_v2.obj
objs/src/http/v2/ngx_http_v2_table.obj
objs/src/http/v2/ngx_http_v2_encode.obj
objs/src/http/v2/ngx_http_v2_huff_decode.obj
objs/src/http/v2/ngx_http_v2_huff_encode.obj
objs/src/http/v2/ngx_http_v2_module.obj
objs/src/http/modules/ngx_http_static_module.obj
objs/src/http/modules/ngx_http_index_module.obj
objs/src/http/modules/ngx_http_mirror_module.obj
objs/src/http/modules/ngx_http_try_files_module.obj
objs/src/http/modules/ngx_http_auth_basic_module.obj
objs/src/http/modules/ngx_http_access_module.obj
objs/src/http/modules/ngx_http_limit_conn_module.obj
objs/src/http/modules/ngx_http_limit_req_module.obj
objs/src/http/modules/ngx_http_geo_module.obj
objs/src/http/modules/ngx_http_map_module.obj
objs/src/http/modules/ngx_http_split_clients_module.obj
objs/src/http/modules/ngx_http_referer_module.obj
objs/src/http/modules/ngx_http_ssl_module.obj
objs/src/http/modules/ngx_http_proxy_module.obj
objs/src/http/modules/ngx_http_fastcgi_module.obj
objs/src/http/modules/ngx_http_grpc_module.obj
objs/src/http/modules/ngx_http_memcached_module.obj
objs/src/http/modules/ngx_http_browser_module.obj
objs/src/http/modules/ngx_http_upstream_hash_module.obj
objs/src/http/modules/ngx_http_upstream_ip_hash_module.obj
objs/src/http/modules/ngx_http_upstream_least_conn_module.obj
objs/src/http/modules/ngx_http_upstream_random_module.obj
objs/src/http/modules/ngx_http_upstream_keepalive_module.obj
objs/src/http/modules/ngx_http_upstream_zone_module.obj
objs/src/http/modules/ngx_http_stub_status_module.obj
objs/src/stream/ngx_stream.obj
objs/src/stream/ngx_stream_variables.obj
objs/src/stream/ngx_stream_script.obj
objs/src/stream/ngx_stream_handler.obj
objs/src/stream/ngx_stream_core_module.obj
objs/src/stream/ngx_stream_log_module.obj
objs/src/stream/ngx_stream_proxy_module.obj
objs/src/stream/ngx_stream_upstream.obj
objs/src/stream/ngx_stream_upstream_round_robin.obj
objs/src/stream/ngx_stream_write_filter_module.obj
objs/src/stream/ngx_stream_ssl_module.obj
objs/src/stream/ngx_stream_limit_conn_module.obj
objs/src/stream/ngx_stream_access_module.obj
objs/src/stream/ngx_stream_geo_module.obj
objs/src/stream/ngx_stream_map_module.obj
objs/src/stream/ngx_stream_split_clients_module.obj
objs/src/stream/ngx_stream_return_module.obj
objs/src/stream/ngx_stream_set_module.obj
objs/src/stream/ngx_stream_upstream_hash_module.obj
objs/src/stream/ngx_stream_upstream_least_conn_module.obj
objs/src/stream/ngx_stream_upstream_random_module.obj
objs/src/stream/ngx_stream_upstream_zone_module.obj
objs/src/stream/ngx_stream_ssl_preread_module.obj
objs/ngx_modules.obj
kernel32.lib user32.lib advapi32.lib ws2_32.lib ../pcre-8.00/pcre-8.00/pcre.lib ../openssl/openssl/lib/ssleay32.lib ../openssl/openssl/lib/libeay32.lib gdi32.lib crypt32.lib ../zlib/zlib.lib
objs/nginx.res -link -verbose:lib -debug objs/ngx_pch.obj
Microsoft (R) Incremental Linker Version 14.00.24215.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:objs/nginx.exe
-verbose:lib
-debug
objs/ngx_pch.obj
objs/src/core/nginx.obj
objs/src/core/ngx_log.obj
objs/src/core/ngx_palloc.obj
objs/src/core/ngx_array.obj
objs/src/core/ngx_list.obj
objs/src/core/ngx_hash.obj
objs/src/core/ngx_buf.obj
objs/src/core/ngx_queue.obj
objs/src/core/ngx_output_chain.obj
objs/src/core/ngx_string.obj
objs/src/core/ngx_parse.obj
objs/src/core/ngx_parse_time.obj
objs/src/core/ngx_inet.obj
objs/src/core/ngx_file.obj
objs/src/core/ngx_crc32.obj
objs/src/core/ngx_murmurhash.obj
objs/src/core/ngx_md5.obj
objs/src/core/ngx_sha1.obj
objs/src/core/ngx_rbtree.obj
objs/src/core/ngx_radix_tree.obj
objs/src/core/ngx_slab.obj
objs/src/core/ngx_times.obj
objs/src/core/ngx_shmtx.obj
objs/src/core/ngx_connection.obj
objs/src/core/ngx_cycle.obj
objs/src/core/ngx_spinlock.obj
objs/src/core/ngx_rwlock.obj
objs/src/core/ngx_cpuinfo.obj
objs/src/core/ngx_conf_file.obj
objs/src/core/ngx_module.obj
objs/src/core/ngx_resolver.obj
objs/src/core/ngx_open_file_cache.obj
objs/src/core/ngx_crypt.obj
objs/src/core/ngx_proxy_protocol.obj
objs/src/core/ngx_syslog.obj
objs/src/event/ngx_event.obj
objs/src/event/ngx_event_timer.obj
objs/src/event/ngx_event_posted.obj
objs/src/event/ngx_event_accept.obj
objs/src/event/ngx_event_udp.obj
objs/src/event/ngx_event_connect.obj
objs/src/event/ngx_event_pipe.obj
objs/src/os/win32/ngx_errno.obj
objs/src/os/win32/ngx_alloc.obj
objs/src/os/win32/ngx_files.obj
objs/src/os/win32/ngx_shmem.obj
objs/src/os/win32/ngx_time.obj
objs/src/os/win32/ngx_process.obj
objs/src/os/win32/ngx_thread.obj
objs/src/os/win32/ngx_socket.obj
objs/src/os/win32/ngx_wsarecv.obj
objs/src/os/win32/ngx_wsarecv_chain.obj
objs/src/os/win32/ngx_udp_wsarecv.obj
objs/src/os/win32/ngx_wsasend.obj
objs/src/os/win32/ngx_wsasend_chain.obj
objs/src/os/win32/ngx_win32_init.obj
objs/src/os/win32/ngx_user.obj
objs/src/os/win32/ngx_dlopen.obj
objs/src/os/win32/ngx_event_log.obj
objs/src/os/win32/ngx_process_cycle.obj
objs/src/event/ngx_event_acceptex.obj
objs/src/event/modules/ngx_iocp_module.obj
objs/src/event/modules/ngx_win32_select_module.obj
objs/src/event/modules/ngx_win32_poll_module.obj
objs/src/event/ngx_event_openssl.obj
objs/src/event/ngx_event_openssl_stapling.obj
objs/src/http/ngx_http.obj
objs/src/http/ngx_http_core_module.obj
objs/src/http/ngx_http_special_response.obj
objs/src/http/ngx_http_request.obj
objs/src/http/ngx_http_parse.obj
objs/src/http/modules/ngx_http_log_module.obj
objs/src/http/ngx_http_request_body.obj
objs/src/http/ngx_http_variables.obj
objs/src/http/ngx_http_script.obj
objs/src/http/ngx_http_upstream.obj
objs/src/http/ngx_http_upstream_round_robin.obj
objs/src/http/ngx_http_file_cache.obj
objs/src/http/ngx_http_write_filter_module.obj
objs/src/http/ngx_http_header_filter_module.obj
objs/src/http/modules/ngx_http_chunked_filter_module.obj
objs/src/http/v2/ngx_http_v2_filter_module.obj
objs/src/http/modules/ngx_http_range_filter_module.obj
objs/src/http/modules/ngx_http_gzip_filter_module.obj
objs/src/http/ngx_http_postpone_filter_module.obj
objs/src/http/modules/ngx_http_ssi_filter_module.obj
objs/src/http/modules/ngx_http_userid_filter_module.obj
objs/src/http/modules/ngx_http_headers_filter_module.obj
objs/src/http/ngx_http_copy_filter_module.obj
objs/src/http/modules/ngx_http_not_modified_filter_module.obj
objs/src/http/v2/ngx_http_v2.obj
objs/src/http/v2/ngx_http_v2_table.obj
objs/src/http/v2/ngx_http_v2_encode.obj
objs/src/http/v2/ngx_http_v2_huff_decode.obj
objs/src/http/v2/ngx_http_v2_huff_encode.obj
objs/src/http/v2/ngx_http_v2_module.obj
objs/src/http/modules/ngx_http_static_module.obj
objs/src/http/modules/ngx_http_index_module.obj
objs/src/http/modules/ngx_http_mirror_module.obj
objs/src/http/modules/ngx_http_try_files_module.obj
objs/src/http/modules/ngx_http_auth_basic_module.obj
objs/src/http/modules/ngx_http_access_module.obj
objs/src/http/modules/ngx_http_limit_conn_module.obj
objs/src/http/modules/ngx_http_limit_req_module.obj
objs/src/http/modules/ngx_http_geo_module.obj
objs/src/http/modules/ngx_http_map_module.obj
objs/src/http/modules/ngx_http_split_clients_module.obj
objs/src/http/modules/ngx_http_referer_module.obj
objs/src/http/modules/ngx_http_ssl_module.obj
objs/src/http/modules/ngx_http_proxy_module.obj
objs/src/http/modules/ngx_http_fastcgi_module.obj
objs/src/http/modules/ngx_http_grpc_module.obj
objs/src/http/modules/ngx_http_memcached_module.obj
objs/src/http/modules/ngx_http_browser_module.obj
objs/src/http/modules/ngx_http_upstream_hash_module.obj
objs/src/http/modules/ngx_http_upstream_ip_hash_module.obj
objs/src/http/modules/ngx_http_upstream_least_conn_module.obj
objs/src/http/modules/ngx_http_upstream_random_module.obj
objs/src/http/modules/ngx_http_upstream_keepalive_module.obj
objs/src/http/modules/ngx_http_upstream_zone_module.obj
objs/src/http/modules/ngx_http_stub_status_module.obj
objs/src/stream/ngx_stream.obj
objs/src/stream/ngx_stream_variables.obj
objs/src/stream/ngx_stream_script.obj
objs/src/stream/ngx_stream_handler.obj
objs/src/stream/ngx_stream_core_module.obj
objs/src/stream/ngx_stream_log_module.obj
objs/src/stream/ngx_stream_proxy_module.obj
objs/src/stream/ngx_stream_upstream.obj
objs/src/stream/ngx_stream_upstream_round_robin.obj
objs/src/stream/ngx_stream_write_filter_module.obj
objs/src/stream/ngx_stream_ssl_module.obj
objs/src/stream/ngx_stream_limit_conn_module.obj
objs/src/stream/ngx_stream_access_module.obj
objs/src/stream/ngx_stream_geo_module.obj
objs/src/stream/ngx_stream_map_module.obj
objs/src/stream/ngx_stream_split_clients_module.obj
objs/src/stream/ngx_stream_return_module.obj
objs/src/stream/ngx_stream_set_module.obj
objs/src/stream/ngx_stream_upstream_hash_module.obj
objs/src/stream/ngx_stream_upstream_least_conn_module.obj
objs/src/stream/ngx_stream_upstream_random_module.obj
objs/src/stream/ngx_stream_upstream_zone_module.obj
objs/src/stream/ngx_stream_ssl_preread_module.obj
objs/ngx_modules.obj
kernel32.lib
user32.lib
advapi32.lib
ws2_32.lib
../pcre-8.00/pcre-8.00/pcre.lib
../openssl/openssl/lib/ssleay32.lib
../openssl/openssl/lib/libeay32.lib
gdi32.lib
crypt32.lib
../zlib/zlib.lib
objs/nginx.res
Searching libraries
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\lib.0.14393.0\ucrt\x64\libucrt.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\lib.0.14393.0\ucrt\x64\libucrt.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\uuid.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Finished searching libraries
Searching libraries
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\kernel32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\user32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\advapi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\ws2_32.lib:
Searching ../pcre-8.00/pcre-8.00/pcre.lib:
Searching ../openssl/openssl/lib/ssleay32.lib:
Searching ../openssl/openssl/lib/libeay32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\gdi32.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\crypt32.lib:
Searching ../zlib/zlib.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\LIBCMT.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\OLDNAMES.lib:
Searching C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64\libvcruntime.lib:
Searching C:\Program Files (x86)\Windows Kits\lib.0.14393.0\ucrt\x64\libucrt.lib:
Searching C:\Program Files (x86)\Windows Kits.1\lib\winv6.3\um\x64\uuid.lib:
Finished searching libraries
nginx.obj : error LNK2019: unresolved external symbol ngx_regex_init referenced in function main
ngx_http_fastcgi_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_stream_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_variables.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_ssi_filter_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_compile
ngx_http_core_module.obj : error LNK2019: unresolved external symbol ngx_regex_exec_array referenced in function ngx_http_gzip_ok
ngx_http_referer_module.obj : error LNK2001: unresolved external symbol ngx_regex_exec_array
objs/nginx.exe : fatal error LNK1120: 3 unresolved externals
事实证明,如果 http_rewrite
模块未被禁用且使用 PCRE 未被禁用,则 USE_PCRE
仅设置为 YES
。您可以在代码 here:
if [ $HTTP_REWRITE = YES -a $USE_PCRE != DISABLED ]; then
USE_PCRE=YES
# ...
fi
一旦我从 auto/configure
命令中删除了 --without-http_rewrite_module
选项,nginx 和 PCRE 就可以正常构建了。