4
回答
osx ei capitan 10.11.1 (15B42) make nginx1.9.5报错
【腾讯云】校园拼团福利,1核2G服务器10元/月!>>>   

我的系统是:osx ei capitan 10.11.1 (15B42)

从nginx官方网站下载 nginx-1.9.5.tar.gz

tar xzf nginx-1.9.5.tar.gz

cd nginx-1.9.5

./configure --prefix=/usr/local/nginx --without-http_rewrite_module --with-http_ssl_module


objs/src/http/modules/ngx_http_upstream_ip_hash_module.o \

objs/src/http/modules/ngx_http_upstream_least_conn_module.o \

objs/src/http/modules/ngx_http_upstream_keepalive_module.o \

objs/src/http/modules/ngx_http_upstream_zone_module.o \

objs/ngx_modules.o \

-lssl -lcrypto -lz

Undefined symbols for architecture x86_64:

  "_SSL_CTX_set_alpn_select_cb", referenced from:

      _ngx_http_ssl_merge_srv_conf in ngx_http_ssl_module.o

  "_SSL_CTX_set_next_protos_advertised_cb", referenced from:

      _ngx_http_ssl_merge_srv_conf in ngx_http_ssl_module.o

  "_SSL_select_next_proto", referenced from:

      _ngx_http_ssl_alpn_select in ngx_http_ssl_module.o

  "_X509_check_host", referenced from:

      _ngx_ssl_check_host in ngx_event_openssl.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: *** [objs/nginx] Error 1

make: *** [build] Error 2

Downloads/nginx-1.9.5 » 

不带 --without-http_rewrite_module --with-http_ssl_module 可以安装成功,但我我需要支持https

求高手指点 ?

举报
leeyi
发帖于2年前 4回/843阅
共有4个答案 最后回答: 2年前

用--with-cc-opt和--with-ld-opt指定openssl头文件和库文件的路径

又或者用--with-openssl=/the/path/to/openssl/source/code/指定openssl源代码的路径

--- 共有 6 条评论 ---
leeyi回复 @无名码农 : 非常感谢啊,弄好了 2年前 回复
无名码农回复 @leeyi : set是ngx_http_rewrite_module提供的指令 2年前 回复
无名码农回复 @leeyi : 去掉--without-http_rewrite_module 2年前 回复
leeyimake 通过了,但是 nginx -t 报错: [emerg] 12964#0: unknown directive "set" in /usr/local/nginx/conf/nginx.conf:71 2年前 回复
leeyi参考 nginx.org/en/docs/configure.html ./configure --prefix=/usr/local/nginx --without-http_rewrite_module --with-http_ssl_module --with-cc-opt="-I /usr/local/include" --with-ld-opt="-L /usr/local/lib" 2年前 回复

我本地 openssl 只用brew安装的最新版本 

/usr/local/Cellar/openssl/1.0.2d_1

make之后还是报错,步骤和错误如下:

tar xzf nginx-1.9.5.tar.gz

cd nginx-1.9.5

./configure --prefix=/usr/local/nginx --without-http_rewrite_module --with-http_ssl_module --with-openssl=/Users/leeyi/Downloads/openssl-1.0.2d

"_i2d_SSL_SESSION", referenced from:

      _ngx_ssl_new_session in ngx_event_openssl.o

      _ngx_http_upstream_save_round_robin_peer_session in ngx_http_upstream_round_robin.o

  "_sk_num", referenced from:

      _ngx_ssl_session_cache in ngx_event_openssl.o

      _ngx_ssl_stapling in ngx_event_openssl_stapling.o

  "_sk_value", referenced from:

      _ngx_ssl_session_cache in ngx_event_openssl.o

      _ngx_ssl_stapling in ngx_event_openssl_stapling.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

make[1]: *** [objs/nginx] Error 1

make: *** [build] Error 2

顶部