Hikey960板子使用过程中,debug for warning as error

问题

代码打上patch后,编译报错。之前合上patch不会报错,近期才出现莫名其妙的问题。

log:cc1: some warnings being treated as errors
LD built_in.o error
fs/built-in.o: In function `preallocation_vblock_check':
/home/ylh/ICPP/hikey-linaro/fs/f2fs/file_preallocate.c:124: undefined reference to `need_SSR'
fs/built-in.o: In function `get_dnode_by_pgofs':
/home/ylh/ICPP/hikey-linaro/fs/f2fs/file_preallocate.c:276: undefined reference to `get_dnode_of_data'
/home/ylh/ICPP/hikey-linaro/fs/f2fs/file_preallocate.c:287: undefined reference to `get_node_info'
fs/built-in.o: In function `alloc_blockaddr':
/home/ylh/ICPP/hikey-linaro/fs/f2fs/file_preallocate.c:325: undefined reference to `f2fs_wait_discard_bio'
fs/built-in.o: In function `update_summary_entry':
/home/ylh/ICPP/hikey-linaro/fs/f2fs/file_preallocate.c:355: undefined reference to `update_meta_page'
make: *** [vmlinux] Error 1

need_SSR,get_node_info等声明在f2fs.h中的文件,找不到函数定义,报错。

尝试1

Makfile中删除一行

KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
           -fno-strict-aliasing -fno-common -fshort-wchar \
           -Wno-format-security \
           -std=gnu89
           #add
           #-Werror-implicit-function-declaration \
           -Wno-format-security \
           -std=gnu89

尝试2:忽略错误

https://stackoverflow.com/questions/11561261/how-to-compile-without-warnings-being-treated-as-errors
If you are compiling linux kernel. For example, if you want to disable the warning that is “unused-but-set-variable” been treated as error. You can add a statement:

KBUILD_CFLAGS += $(call cc-option,-Wno-error=unused-but-set-variable,)

尝试3:改变perf

https://discuss.96boards.org/t/perf-tool-820c-with-linaro-debian/5031/8
Thanks for the update.

For future reference: if you are trying to build old versions of
perf (such as v4.14) with a very new compiler you can add WERROR=0 to
prevent any newly introduced warnings from causing the build to fail.

(cd tools/perf; make WERROR=0)

真实原因:因为F2FS工程的patch在不断更新,需要保证打patch的旧版本是一样,否则会因为一些结构和函数更新导致冲突。分析源代码解决这些冲突就可以了。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值