构建nginx docker时出错

时间:2017-07-09 13:08:56

标签: nginx docker

我正在尝试从fork构建一个docker,我在执行docker build ./时遇到以下错误:

cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2

安装时我们运行

apt-get -y install libpcre3-dev zlib1g-dev libssl-dev openssl build-essential wget

我无法在谷歌上找到此错误。完整的错误以供参考,因为我无法找到我需要研究的确切错误参考:

src/event/ngx_event_openssl.c: In function 'ngx_ssl_init':
src/event/ngx_event_openssl.c:112:5: error: 'OPENSSL_config' is deprecated [-Werror=deprecated-declarations]
     OPENSSL_config(NULL);
     ^~~~~~~~~~~~~~
In file included from /usr/include/openssl/ct.h:13:0,
                 from /usr/include/openssl/ssl.h:61,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:80,
                 from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/conf.h:92:1: note: declared here
 DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
 ^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_rsa512_key_callback':
src/event/ngx_event_openssl.c:753:9: error: 'RSA_generate_key' is deprecated [-Werror=deprecated-declarations]
         key = RSA_generate_key(512, RSA_F4, NULL, NULL);
         ^~~
In file included from /usr/include/openssl/rsa.h:13:0,
                 from /usr/include/openssl/x509.h:31,
                 from /usr/include/openssl/ssl.h:50,
                 from src/event/ngx_event_openssl.h:15,
                 from src/core/ngx_core.h:80,
                 from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rsa.h:193:1: note: declared here
 DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
 ^
src/event/ngx_event_openssl.c: In function 'ngx_ssl_dhparam':
src/event/ngx_event_openssl.c:943:11: error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
         dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
           ^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_handshake':
src/event/ngx_event_openssl.c:1164:31: error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
         if (c->ssl->connection->s3) {
                               ^~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_connection_error':
src/event/ngx_event_openssl.c:1913:21: error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
             || n == SSL_R_NO_CIPHERS_PASSED                          /*  182 */
                     ^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c:1913:21: note: each undeclared identifier is reported only once for each function it appears in
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_cache':
src/event/ngx_event_openssl.c:2107:43: error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type [-Werror=incompatible-pointer-types]
         SSL_CTX_sess_set_get_cb(ssl->ctx, ngx_ssl_get_cached_session);
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/event/ngx_event_openssl.h:15:0,
                 from src/core/ngx_core.h:80,
                 from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/ssl.h:637:6: note: expected 'SSL_SESSION * (*)(struct ssl_st *, const unsigned char *, int,  int *) {aka struct ssl_session_st * (*)(struct ssl_st *, const unsigned char *, int,  int *)}' but argument is of type 'SSL_SESSION * (*)(SSL *, u_char *, int,  int *) {aka struct ssl_session_st * (*)(struct ssl_st *, unsigned char *, int,  int *)}'
 void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx,
      ^~~~~~~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_id_context':
src/event/ngx_event_openssl.c:2129:27: error: storage size of 'md' isn't known
     EVP_MD_CTX            md;
                           ^~
src/event/ngx_event_openssl.c:2195:5: error: implicit declaration of function 'EVP_MD_CTX_cleanup' [-Werror=implicit-function-declaration]
     EVP_MD_CTX_cleanup(&md);
     ^~~~~~~~~~~~~~~~~~
src/event/ngx_event_openssl.c: In function 'ngx_ssl_session_ticket_key_callback':
src/event/ngx_event_openssl.c:2864:9: error: 'RAND_pseudo_bytes' is deprecated [-Werror=deprecated-declarations]
         RAND_pseudo_bytes(iv, 16);
         ^~~~~~~~~~~~~~~~~
In file included from /usr/include/openssl/engine.h:19:0,
                 from src/event/ngx_event_openssl.h:22,
                 from src/core/ngx_core.h:80,
                 from src/event/ngx_event_openssl.c:9:
/usr/include/openssl/rand.h:47:1: note: declared here
 DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
 ^
cc1: all warnings being treated as errors
make[1]: *** [objs/src/event/ngx_event_openssl.o] Error 1
objs/Makefile:748: recipe for target 'objs/src/event/ngx_event_openssl.o' failed
make[1]: Leaving directory '/tmp/nginx/nginx-1.8.0'
make: *** [install] Error 2

这是我正在运行的docker fork https://github.com/meteorhacks/mup-frontend-server

2 个答案:

答案 0 :(得分:3)

您在这里收到各种错误和警告,但它们并不是关于Docker或OpenSSL的。如果我们删除了无关的信息,以下是您遇到的问题。

error: 'OPENSSL_config' is deprecated
error: 'RSA_generate_key' is deprecated
error: dereferencing pointer to incomplete type 'DH {aka struct dh_st}'
error: dereferencing pointer to incomplete type 'SSL {aka struct ssl_st}'
error: 'SSL_R_NO_CIPHERS_PASSED' undeclared (first use in this function)
error: passing argument 2 of 'SSL_CTX_sess_set_get_cb' from incompatible pointer type
error: storage size of 'md' isn't known
error: implicit declaration of function 'EVP_MD_CTX_cleanup'
error: 'RAND_pseudo_bytes' is deprecated

问题的核心可能是你在这个项目中使用的是遗留版本的Nginx。从您指向的GitHub存储库中,install-nginx.sh

NGINX_VERSION=1.8.0

Nginx的当前主线版本是1.13.2。我没有梳理Nginx的更改日志,但根据您收到的错误,似乎在1.8版本和当前版本之间,OpenSSL已经弃用了Nginx 1.8所依赖的各种功能。最有可能的是,这可以通过迁移到最近发布的Nginx来解决。

在撰写本文时,1.13.2是当前主线,1.12.0是当前的稳定线。其中一个可能会更好。你是否可以简单地放入,我不能说。您可能必须在构建脚本或nginx配置中更改某些内容才能使更新版本正常工作。

答案 1 :(得分:2)

您收到此错误是因为您的nginx版本不支持SSL 1.1.0。升级NGINX版本或使用SSL 1.0.2。