happyfish100 / fastdfs-nginx-module

FastDFS nginx module
GNU Lesser General Public License v3.0
434 stars 260 forks source link

The install nginx error! #90

Closed codeWang-J closed 2 years ago

codeWang-J commented 2 years ago

/fastdfs-nginx-module-1.20/src/common.c:902:42: error: ‘%s’ directive output may be truncated writing up to 510 bytes into a region of size between 111 and 127 [-Werror=format-truncation=] 901 | file_id_without_group = uri + 1; //skip / | ~~~~~~~
902 | snprintf(file_id, sizeof(file_id), "%s/%s", \ | ^~ In file included from /usr/include/stdio.h:866, from src/os/unix/ngx_linux_config.h:23, from src/core/ngx_config.h:26, from /home/wj/fastdfs-nginx-module-1.20/src/ngx_http_fastdfs_module.c:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘builtin___snprintf_chk’ output between 2 and 528 bytes into a destination of size 128 71 | return builtin_snprintf_chk (s, n, USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~ 72 | glibc_objsize (s), fmt, | ~~~~~~~~~ 73 | va_arg_pack ()); | ~~~~~ In file included from /home/wj/fastdfs-nginx-module-1.20/src/ngx_http_fastdfs_module.c:6: /home/wj/fastdfs-nginx-module-1.20/src/common.c:856:39: error: ‘%s’ directive output may be truncated writing up to 510 bytes into a region of size 128 [-Werror=format-truncation=] 856 | snprintf(file_id, sizeof(file_id), "%s", uri + 1); | ~~~~~~~~^~~~~ In file included from /usr/include/stdio.h:866, from src/os/unix/ngx_linux_config.h:23, from src/core/ngx_config.h:26, from /home/wj/fastdfs-nginx-module-1.20/src/ngx_http_fastdfs_module.c:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘builtin_snprintf’ output between 1 and 511 bytes into a destination of size 128 71 | return builtin_snprintf_chk (s, n, USE_FORTIFY_LEVEL - 1, | ^~~~~~~~~~~~~~~~ 72 | __glibc_objsize (s), fmt, | ~~~~~~~~~ 73 | __va_arg_pack ()); | ~~~~~ cc1: all warnings being treated as errors make[1]: [objs/Makefile:1207:objs/addon/src/ngx_http_fastdfs_module.o] 错误 1 make[1]: 离开目录“/home/wj/nginx-1.15.2” make: [Makefile:8:build] 错误 2

happyfish100 commented 2 years ago

烦请告知操作系统和gcc的版本号

loriensinsight commented 2 years ago

烦请告知操作系统和gcc的版本号

我有类似的报错 操作系统是Debian GNU/Linux 11 (bullseye) (在win10或win server2016下wmware起的虚拟机) gcc的版本是gcc version 10.2.1 20210110 (Debian 10.2.1-6) fdfs版本6.0.7 libfastcommon版本1.0.55 fastdfs-nginx-module版本1.22 nginx 1.15.1、1.18.0、1.21.5均是同样报错

make命令执行后输出:

cc -c -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE='256*1024' -DFDFS_MOD_CONF_FILENAME='"/etc/fdfs/mod_fastdfs.conf"' -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules -I /usr/local/include \ -o objs/addon/src/ngx_http_fastdfs_module.o \ /opt/fdfs/fastdfs-nginx-module-1.22/src/ngx_http_fastdfs_module.c In file included from /opt/fdfs/fastdfs-nginx-module-1.22/src/ngx_http_fastdfs_module.c:6: /opt/fdfs/fastdfs-nginx-module-1.22/src/common.c: In function ‘fdfs_http_request_handler’: /opt/fdfs/fastdfs-nginx-module-1.22/src/common.c:903:42: error: ‘%s’ directive output may be truncated writing up to 510 bytes into a region of size between 111 and 127 [-Werror=format-truncation=] 902 | file_id_without_group = uri + 1; //skip / | ~~~~~~~
903 | snprintf(file_id, sizeof(file_id), "%s/%s", \ | ^~ /opt/fdfs/fastdfs-nginx-module-1.22/src/common.c:903:3: note: ‘snprintf’ output between 2 and 528 bytes into a destination of size 128 903 | snprintf(file_id, sizeof(file_id), "%s/%s", \ | ^~~~~~~~~~~~~ 904 | my_group_name, file_id_without_group); | ~~~~~~~~~ /opt/fdfs/fastdfs-nginx-module-1.22/src/common.c:857:39: error: ‘%s’ directive output may be truncated writing up to 510 bytes into a region of size 128 [-Werror=format-truncation=] 857 | snprintf(file_id, sizeof(file_id), "%s", uri + 1); | ~~~~~~~~^~~~~ /opt/fdfs/fastdfs-nginx-module-1.22/src/common.c:857:3: note: ‘snprintf’ output between 1 and 511 bytes into a destination of size 128 857 | snprintf(file_id, sizeof(file_id), "%s", uri + 1); | ^~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: [objs/Makefile:1205:objs/addon/src/ngx_http_fastdfs_module.o] 错误 1 make[1]: 离开目录“/home/c/tmp/fdfs/nginx-1.15.1” make: [Makefile:8:build] 错误 2

happyfish100 commented 2 years ago

感谢反馈,问题已修复,使用 master分支即可。 对于大于等于7.0的gcc,需要在CFLAGS中增加选项:-Wformat-truncation=0 -Wformat-overflow=0