android编译error, forbidden warning出错问题解决
android编译Kernel时,从高版本GCC起,就开始把warning作为error对待,比如我们遇到:
gsl3670.c21: warning: unused variable ‘client’ [-Wunused-variable]
error, forbidden warning: gsl3670.c:2065
表示定义了client但没有使用,此warning作为error来对待,编译报错了,有以下几种解决方法:
1.修改自己的代码,将出现的警告全部解决掉.该强制转换的强制转化,该删掉定义了未使用的变量函数删掉或者注释掉。但这种方法要修改的地方可能比较多,比较麻烦。
2.makefile文件的KBUILD_CFLAGS增加-w,以下所示:
kernel\msm-4.9\Makefile
KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common \
-Werror-implicit-function-declaration \
-Wno-format-security \
-w \ #增加这项
-std=gnu89
3.gcc-wrapper.py中注释掉interpret_warning(line)即可
kernel\msm-4.9\scripts\gcc-wrapper.py
try:
proc = subprocess.Popen(args, stderr=subprocess.PIPE)
for line in proc.stderr:
print >> sys.stderr, line,
#interpret_warning(line) #注释掉这行
按照第2和第3种方法的处理后,这样它就不会将警告当成错误处理了,这里我们采用第3种方法。
还没有评论,来说两句吧...