【发布时间】:2018-07-01 02:09:06
【问题描述】:
我正在尝试从源代码安装intel's psm package。当我运行make 时,我得到了这个奇怪的错误。
$ make
...
make libpsm_infinipath.so
make[1]: Entering directory `/home/kilojoules/psm'
cc -Wall -Werror -fpic -fPIC -D_GNU_SOURCE -funwind-tables -O3 -g3 -DNVALGRIND -I. -I/home/kilojoules/psm/include -I/home/kilojoules/psm/mpspawn -I/home/kilojoules/psm/include/linux-x86_64 -c psm_context.c -o psm_context.o
cc -Wall -Werror -fpic -fPIC -D_GNU_SOURCE -funwind-tables -O3 -g3 -DNVALGRIND -I. -I/home/kilojoules/psm/include -I/home/kilojoules/psm/mpspawn -I/home/kilojoules/psm/include/linux-x86_64 -c psm_ep.c -o psm_ep.o
psm_ep.c: In function '__psm_ep_open':
psm_ep.c:1013:27: error: '%1d' directive output may be truncated writing between 1 and 5 bytes into a region of size 4 [-Werror=format-truncation=]
snprintf(pvalue, 4, "%1d", ports[0]);
^~~
psm_ep.c:1013:26: note: directive argument in the range [0, 65535]
snprintf(pvalue, 4, "%1d", ports[0]);
^~~~~
psm_ep.c:1013:6: note: 'snprintf' output between 2 and 6 bytes into a destination of size 4
snprintf(pvalue, 4, "%1d", ports[0]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
psm_ep.c:1041:27: error: '%1d' directive output may be truncated writing between 1 and 5 bytes into a region of size 4 [-Werror=format-truncation=]
snprintf(pvalue, 4, "%1d", ports[i]);
^~~
psm_ep.c:1041:26: note: directive argument in the range [0, 65535]
snprintf(pvalue, 4, "%1d", ports[i]);
^~~~~
psm_ep.c:1041:6: note: 'snprintf' output between 2 and 6 bytes into a destination of size 4
snprintf(pvalue, 4, "%1d", ports[i]);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [psm_ep.o] Error 1
make: *** [libs] Error 2
我想抑制错误。这似乎是一个警告而不是错误。这是我可以在这里做的吗?我该怎么做?
【问题讨论】:
-
您需要修改 Makefile 以从 cc 命令中删除 -Werror 标志。这导致警告被视为错误。