安装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
  1. 如果没有改下面错误二的“-Werror”,先把按照错误二改好
  2. 试运行make或者sudo make install
  3. 如果依然报错,就进去报错目录下,打开指定的报错文件,将报错行注释
    在这里插入图片描述

错误二:

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将所有的警告当成错误进行处理

posted @ 2021-01-16 19:03  Οo白麒麟оΟ  阅读(505)  评论(0编辑  收藏  举报