In function ‘char* strncpy(char*, const char*, size_t)’,
inlined from ‘Agent::queryLocalData(std::string&, ResponseDataT&)’ at ./Agent/Agent.cc:715:14:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: error: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 255 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
for the above error message:
we should open floder : OpenNI-Linux-x64-x.x.xx(version number)
then open file : Samples/SimpleViewer/CommonCppMakefile
Delete lines 74-76
The delete contents are as follows:
- ifneq "$(ALLOW_WARNINGS)" "1"
- CFLAGS += -Werror
- ifeq ("$(OSTYPE)","Darwin")
- CFLAGS += -Wno-deprecated-declarations -Wno-unused-private-field -Wno-unused-const-variable
- endif
- endif
Then save the file and get out
use command 'make' to compile
Reference:
- GCC 9.4 编译 specified bound 255 equals destination size [-Werror=stringop-truncation]_lm_hao的博客-CSDN博客前提最近项目需要使用最新的 Ubuntu 20.4,查看下 编译器版本居然是 9.4.0,自然项目迁移过程中会有很多编译问题需要解决,毕竟之前的 gcc 版本都是 4.8.5的,差距很大。环境lm@lm:~$ uname -aLinux leimin 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64 x86_64 x86_64 GNU/Linuxlm@lm:~$ gcc -vUsing built-in
https://blog.csdn.net/llm_hao/article/details/124279032?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1-124279032-blog-113791634.pc_relevant_multi_platform_whitelistv1&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1-124279032-blog-113791634.pc_relevant_multi_platform_whitelistv1