nginx編譯報錯src/core/ngx_murmurhash.c:37:11: 錯誤:this statement may fall through [-Werror=implicit-fallthrough=] h ^= data[2]


報錯信息如下

make -f objs/Makefile
make[1]: 進入目錄“/opt/nginx-1.8.1”
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: 在函數‘ngx_murmur_hash2’中:
src/core/ngx_murmurhash.c:37:11: 錯誤:this statement may fall through [-Werror=implicit-fallthrough=]
         h ^= data[2] << 16;
         ~~^~~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:38:5: 附注:here
     case 2:
     ^~~~
src/core/ngx_murmurhash.c:39:11: 錯誤:this statement may fall through [-Werror=implicit-fallthrough=]
         h ^= data[1] << 8;
         ~~^~~~~~~~~~~~~~~
src/core/ngx_murmurhash.c:40:5: 附注:here
     case 1:
     ^~~~
cc1:所有的警告都被當作是錯誤
make[1]: *** [objs/Makefile:431:objs/src/core/ngx_murmurhash.o] 錯誤 1
make[1]: 離開目錄“/opt/nginx-1.8.1”
make: *** [Makefile:8:build] 錯誤 2

原因:將警告當成錯誤處理

解決錯誤1:進入到nginx-1.6.3目錄下(解壓的目錄)

找到當前目錄下找到objs文件夾,並進入,打開文件Makefile,找到有一下內容的這行:

[root@lnmp nginx-1.8.1]# vim objs/Makefile
CFLAGS =  -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g 

-Werror: gcc將所有的警告當成錯誤進行處理把這行內容中的 “-Werror”去掉

摘自:https://bbs.cnbugs.com/read-37-1.html

感謝分享

 

  


免責聲明!

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



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