问题
代码打上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的旧版本是一样,否则会因为一些结构和函数更新导致冲突。分析源代码解决这些冲突就可以了。