Error problems that may occur when nginx is installed by make compilation _nginx_ Scripting home

Error issues that may occur when nginx is installed with make compilation

Updated: Jun 06, 2024 11:39:30 AM Author: Learn to make a living
This article mainly introduces the nginx installation,make compilation may occur error problems, has a good reference value, I hope to help you, if there are errors or not considered completely, please advise

First, report an error

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

Analyze the reasons:

Open the nginx installation directory /objs/Makefile, remove -Werror from CFLAGS, and make again

  • -Wall Enables all warnings of gcc
  • -Werror, which requires gcc to treat all warnings as errors

Second, make errors

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 'does not have a member named' current_salt ': cd.current_salt[0] = ~salt[0];

The best way is to change the version, because of the condition, we will go into the source code and comment out this line.

# vim src/os/unix/ngx_user.c Go inside and comment out 36 lines

The third error is the openssl version error

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

The reason:

The default openssl 1.1.x version is used, resulting in inconsistent apis

Resolved:

Install openssl1.0 directly

Wget HTTP: / / http://www.openssl.org/source/openssl-1.1.0e.tar.gz / / download openssl/root @ iZgt88z6l1kvd7Z ~ # tar ZXVF. - Openssl-1.0e.tar. gz // Decompress [root@iZgt88z6l1kvd7Z ~]# cd openssl-1.0e / &&./config shared zlib --prefix=/usr/local/openssl &&make && make install Go to the directory to compile and install openssl in /usr/local/openssl [root@iZgt88z6l1kvd7Z openssl-1.1.0e]#./config -t [root@iZgt88z6l1kvd7Z openssl-1.1.0e]# make depend // A rule for a makefile, by scanning all C\C++ code in a directory, Thus judge the dependency between files, such as the a.c file called b.h(such as the situation include ), if the a.c file is changed later, it only needs to be re-translated a.c file, do not need to compile the b.h file. Otherwise all files need to be recompiled. [root@localhost openssl-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 Note that everyone's directory is different, I am here under the root openssl, as for others to see their own situation, Switch directory [root@iZgt88z6l1kvd7Z openssl-1.0e]# ldconfig [root@iZgt88z6l1kvd7Z openSSL-1.0e]# echo $? 0 [root @ iZgt88z6l1kvd7Z openssl - 1.1.0 e] # echo "PATH = $PATH: / usr/local/openssl/bin" > > / etc/profile && source/etc/profile

Then re-enter nginx-1.9.9 and run [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 I have this command here, and yours./configure... It depends on you

make a new one

Sum up

The above is personal experience, I hope to give you a reference, but also hope that you support the script home.

Related article

Latest comments