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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM