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 既可.

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值