ubuntu 安装nginx ./configure 编译出错问题

./configure: error: C compiler cc is not found

解决办法 apt install g++

./configure: error: the HTTP rewrite module requires the PCRE library.

解决办法 apt install libpcre3 libpcre3-dev

./configure: error: SSL modules require the OpenSSL library.

解决办法 apt install openssl libssl-dev

./configure: error: the HTTP gzip module requires the zlib library.

解决办法 下载zlib-1.2.8.tar.gz 解压,./configure  && make && make install安装

./configure: error: the HTTP XSLT module requires the libxml2/libxslt

解决办法 apt-get install libxml2 libxml2-dev libxslt-dev

  

URCE=2 -I src/core -I src/event -I src/event/modules -I src/os/unix -I /home/always/tools/nginx-rtmp-module -I /usr/include/libxml2 -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:659: recipe for target 'objs/src/core/ngx_murmurhash.o' failed
make[1]: *** [objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory '/home/always/tools/nginx-1.10.3'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

 原因,是将警告当成了错误处理,打开./objs/Makefile,

CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g (去掉-Werror)
再重新make -j2
-Wall 表示打开gcc的所有警告
-Werror,它要求gcc将所有的警告当成错误进行处理

 

#\cp objs/nginx /usr/local/nginx/sbin/nginx

如果提示“cp:cannot create regular file `/usr/local/nginx/sbin/nginx': Text file busy”

建议使用如下语句cp

#cp -rfp objs/nginx /usr/local/nginx/sbin/nginx

posted @ 2019-08-08 14:34  liehuofeihu  阅读(3020)  评论(0编辑  收藏  举报