f-stack中nginx配置后make出现error: ignoring return value of ‘ftruncate’

问题

Nginx 配置后 make 出现error:

src/os/unix/ngx_process_cycle.c: In function ‘ngx_start_worker_processes’:
src/os/unix/ngx_process_cycle.c:388:5: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void) ftruncate(shm_fd, sizeof(sem_t));
     ^
cc1: all warnings being treated as errors
objs/Makefile:799: recipe for target 'objs/src/os/unix/ngx_process_cycle.o' failed
make[1]: *** [objs/src/os/unix/ngx_process_cycle.o] Error 1
make[1]: Leaving directory '/home/sdn/f-stack/app/nginx-1.11.10'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

环境

  • The compiling environment is Ubuntu

  • uname -r:4.13.0-45-generic
  • cc -v:gcc version 5.4.0

DPDK和F-stack可以成功安装,但是Nginx无法make。

按照原文档的方式配置configure:

# bash ./configure --prefix=/usr/local/nginx_fstack --with-ff_module

# make
  • 出现以下error:
src/os/unix/ngx_process_cycle.c: In function ‘ngx_start_worker_processes’:
src/os/unix/ngx_process_cycle.c:388:5: error: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Werror=unused-result]
     (void) ftruncate(shm_fd, sizeof(sem_t));
     ^
cc1: all warnings being treated as errors
objs/Makefile:799: recipe for target 'objs/src/os/unix/ngx_process_cycle.o' failed
make[1]: *** [objs/src/os/unix/ngx_process_cycle.o] Error 1
make[1]: Leaving directory '/home/sdn/f-stack/app/nginx-1.11.10'
Makefile:8: recipe for target 'build' failed
make: *** [build] Error 2

解决办法

在配置文件的时候,键入:

./configure --prefix=/usr/local/nginx_fstack --with-ff_module --with-cc-opt="-Wno-implicit-fallthrough -Wno-unused-result"

github issues

  • 感谢那位工程师的回复!!

转载于:https://www.cnblogs.com/vancasola/p/9335724.html

你可能感兴趣的:(f-stack中nginx配置后make出现error: ignoring return value of ‘ftruncate’)