Ubuntu20 android编译环境踩坑日记 --nonhlos

Ubuntu20 android编译环境踩坑日记 --nonhlos

在 ubuntu20 上编译高通平台nonhlos的 Basetools的时候,会报错

In function ‘strncpy’,
inlined from ‘splitName’ at …/…/src/pyi_launch.c:83:5,
inlined from ‘_extract_dependency’ at …/…/src/pyi_launch.c:215:9:
/usr/include/aarch64-linux-gnu/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound 512 equals destination size [-Werror=stringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

string_fortified.h 文件是 /usr/include/string.h 文件里引用:

#if __GNUC_PREREQ (3,4)
# if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
/* Functions with security checks.  */
#  include <bits/string_fortified.h>
# endif
#endif

我们可以注释掉这句话,但是还是会有其他类似的检查警告.所以我们可以直接修改 nonhlos编译 Basetools的编译参数,让他忽略警告而不报错.

amss_4250_spf1.0/BOOT.XF.4.1/boot_images/BaseTools/Source/C/Makefiles/header.makefile:
BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-unused-result -nostdlib -c -g

如上文件中,删除 -Werror 既可.

猜你喜欢

转载自blog.csdn.net/qq_40211991/article/details/108095698
今日推荐