nginx 编译时出现的问题解决
因为项目需要,于是在一台新的服务器上 准备安装nginx ,需要装两个扩展pcre,zlib。因为比较简单,这里就不多做叙述了,提供三个关键命令参考一下
- sudo apt-get install libpcre3 libpcre3-dev
- sudo apt-get install openssl libssl-dev
- sudo apt-get install zlib1g-dev
- 准备工作做好后,make编译时却出现问题,因为sudo,所以也不是权限问题,遇到的问题如下:
-
cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \ -o objs/src/core/ngx_murmurhash.o \ src/core/ngx_murmurhash.c 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 objs/Makefile:431: recipe for target 'objs/src/core/ngx_murmurhash.o' failed make[1]: *** [objs/src/core/ngx_murmurhash.o] Error 1 make[1]: 离开目录“/home/python/PycharmProjects/nginx-1.8.1” Makefile:8: recipe for target 'build' failed make: *** [build] Error 2
- 解决办法:
困惑了我好久,于是查资料查到-Werrori这个东西。
(如截图中办法,进入到 /nginx-1.8.1/objs/Makefile中),找到 -Werrori ,删掉保存,在重新sudo make就O啦!