安装nginx报错
错误一:安装nginx报错“src/os/unix/ngx_user.c:26:7: error: ‘struct crypt_data’ has no member named ‘current_salt’”
“src/os/unix/ngx_user.c:26:7: error: ‘struct crypt_data’ has no member named ‘current_salt’”
- 1
- vim src/os/unix/ngx_user.c
- 如果没有改下面错误二的“-Werror”,先把按照错误二改好
- 试运行make或者sudo make install
- 如果依然报错,就进去报错目录下,打开指定的报错文件,将报错行注释
错误二:
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
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
原因:将警告当成错误处理
解决错误1:进入到nginx-1.10.3目录下(即解压的目录)
找到当前目录下找到objs文件夹,并进入,打开文件Makefile,找到有一下内容的这行:
CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g
- 1
cd objs
vim Makefile
把这行内容中的 “-Werror”去掉
-Werror: gcc将所有的警告当成错误进行处理
每天逼着自己写点东西,终有一天会为自己的变化感动的。这是一个潜移默化的过程,每天坚持编编故事,自己不知不觉就会拥有故事人物的特质的。 Explicit is better than implicit.(清楚优于含糊)