第一个,报错
src/core/ngx_murmurhash.c: In function ‘ngx_murmur_hash2’:
src/core/ngx_murmurhash.c:37:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[2] << 16;
^~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: note: here
case 2:
^~~~
src/core/ngx_murmurhash.c:39:11: error: this statement may fall through [-Werror=implicit-fallthrough=]
h ^= data[1] << 8;
^~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: note: here
case 1:
^~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:473: objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory ‘/root/nginx-1.10.1‘
make: *** [Makefile:8: build] Error 2
分析原因:
是将警告当成了错误处理,打开 nginx的安装目录/objs/Makefile,
去掉CFLAGS中的-Werror,再重新make
-Wall 表示打开gcc的所有警告
-Werror,它要求gcc将所有的警告当成错误进行处理
第二个,make出现的错误
src/os/unix/ngx_user.c: In function ‘ngx_libc_crypt’:
src/os/unix/ngx_user.c:36:7: error: ‘struct crypt_data’ has no member named ‘current_salt’
cd.current_salt[0] = ~salt[0];
^
make[1]: *** [objs/Makefile:774: objs/src/os/unix/ngx_user.o] Error 1
make[1]: Leaving directory ‘/root/nginx-1.10.1‘
make: *** [Makefile:8: build] Error 2
这里提示我们struct crypt_data’没有名为‘current_salt’的成员:cd.current_salt[0] = ~salt[0];
最好的办法是换一个版本,因为条件限制,我们就进到源码里把这行直接注释掉好了。
# vim src/os/unix/ngx_user.c
进入里面注释掉36行
第三个错误openssl版本错误
src/event/ngx_event_openssl.c: In function ‘ngx_ssl_dhparam’:
src/event/ngx_event_openssl.c:954: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_connection_error’:
src/event/ngx_event_openssl.c:1941:21: error: ‘SSL_R_NO_CIPHERS_PASSED’ undeclared (first use in this function); did you mean ‘SSL_R_NO_CIPHERS_SPECIFIED’?
|| n == SSL_R_NO_CIPHERS_PASSED /* 182 */
^~~~~~~~~~~~~~~~~~~~~~~
SSL_R_NO_CIPHERS_SPECIFIED
src/event/ngx_event_openssl.c:1941:21: note: each undeclared identifier is reported only once for each function it appears in
make[1]: *** [objs/Makefile:816: objs/src/event/ngx_event_openssl.o] Error 1
make[1]: Leaving directory ‘/root/nginx-1.10.1‘
make: *** [Makefile:8: build] Error 2
原因:由于默认使用了openssl 1.1.x 版本,导致的API不一致引起
解决:
直接安装openssl1.0版本
wget http://www.openssl.org/source/openssl-1.1.0e.tar.gz
//下载openssl
[root@iZgt88z6l1kvd7Z ~]#
tar -zxvf openssl-1.1.0e.tar.gz
//解压
[root@iZgt88z6l1kvd7Z ~]#
cd openssl-1.1.0e/ &&./config shared zlib --prefix=/usr/local/openssl && make && make install
进入目录把openssl编译安装到 /usr/local/openssl 下
[root@iZgt88z6l1kvd7Z openssl-1.1.0e]#
./config -t
[root@iZgt88z6l1kvd7Z openssl-1.1.0e]#
make depend
//一种度makefile的规则,通过扫描仪个目录下的所有C\C++ 代码,从而判专断出文件之间的依赖关系,如a.cc文件中调用了b.h(如以形势include<b.h>),如果之后a.cc文件被改动,那 么只需要重新编属译a.cc文件,不需要编译b.h文件。否则所有的文件都需要重新编译。
[root@localhost openssl-1.1.0e]#
cd /usr/local
[root@iZgt88z6l1kvd7Z local]#
ln -s openssl ssl
[root@iZgt88z6l1kvd7Z local]#
echo "/usr/local/openssl/lib" >>/etc/ld.so.conf
[root@iZgt88z6l1kvd7Z local]#
cd /root/openssl-1.1.0e
注意每个人的目录都是不一样的,我这里是root下的openssl,至于其他人看自己情况,切换目录
[root@iZgt88z6l1kvd7Z openssl-1.1.0e]#
ldconfig
[root@iZgt88z6l1kvd7Z openssl-1.1.0e]#
echo $?
0
[root@iZgt88z6l1kvd7Z openssl-1.1.0e]#
echo "PATH=$PATH:/usr/local/openssl/bin" >> /etc/profile && source /etc/profile
然后重新进入nginx-1.9.9执行[root@iZwz967a5gqt3aqi2g3pbkZ nginx-1.9.9]#
./configure --prefix=/usr/local/nginx --add-module=/root/nginx-1.9.9/headers-more-nginx-module-0.33 --with-http_stub_status_module --with-http_ssl_module
注意,我这里的是这条命令,至于你们的
./configure……
就看你们自身情况
重新
make
一下哎
版权归原作者 程序员爱你帅超 所有, 如有侵权,请联系我们删除。