首页 > 解决方案 > 编译错误,在 qcacld-2.0 中用属性错误声明

问题描述

CC      drivers/staging/qcacld-2.0/CORE/SERVICES/COMMON/adf/adf_nbuf.o
In file included from include/linux/linkage.h:4:0,
                 from include/linux/kernel.h:6,
                 from drivers/staging/qcacld-2.0/CORE/SERVICES/COMMON/adf/adf_nbuf.c:29:
drivers/staging/qcacld-2.0/CORE/SERVICES/COMMON/adf/adf_nbuf.c: In function '__adf_nbuf_validate_skb_cb':
include/linux/compiler.h:347:38: error: call to '__compiletime_assert_1270' declared with attribute error: BUILD_BUG_ON failed: sizeof(struct cvg_nbuf_cb) > FIELD_SIZEOF(struct sk_buff, cb)
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
                                      ^
include/linux/compiler.h:330:4: note: in definition of macro '__compiletime_assert'
    prefix ## suffix();    \
    ^
include/linux/compiler.h:347:2: note: in expansion of macro '_compiletime_assert'
  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
  ^
include/linux/bug.h:50:37: note: in expansion of macro 'compiletime_assert'
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^
include/linux/bug.h:74:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
  BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
  ^
drivers/staging/qcacld-2.0/CORE/SERVICES/COMMON/adf/adf_nbuf.c:1269:2: note: in expansion of macro 'BUILD_BUG_ON'
  BUILD_BUG_ON(sizeof(struct cvg_nbuf_cb) >
  ^
scripts/Makefile.build:308: recipe for target 'drivers/staging/qcacld-2.0/CORE/SERVICES/COMMON/adf/adf_nbuf.o' failed
make[3]: *** [drivers/staging/qcacld-2.0/CORE/SERVICES/COMMON/adf/adf_nbuf.o] Error 1
scripts/Makefile.build:455: recipe for target 'drivers/staging/qcacld-2.0' failed
make[2]: *** [drivers/staging/qcacld-2.0] Error 2
scripts/Makefile.build:455: recipe for target 'drivers/staging' failed
make[1]: *** [drivers/staging] Error 2
Makefile:824: recipe for target 'drivers' failed
make: *** [drivers] Error 2

我该如何解决?

标签: androidcompilationlinux-kernelcompiler-warningsxiaomi

解决方案


像这样https://android.googlesource.com/kernel/msm/+/e7fb62baa7c8b803d7e3b3f3d8bf4e2b916b659d在你的根 makefile 中核对 python 包装器

以及来自 qcacld 的 Kbuild 的 nuke Wall 和 Werror 标志 https://github.com/DerpGang/msm-3.18/blob/f8b18a46f0da4d3aed84f29eb29f2578884e90d4/drivers/staging/qcacld-2.0/Kbuild#L1009

https://github.com/DerpGang/msm-3.18/blob/f8b18a46f0da4d3aed84f29eb29f2578884e90d4/drivers/staging/qcacld-2.0/Kbuild#L1008

在这里,我们禁用了编译器标志,因此代码警告不会被视为错误。

注意:- 如果删除 python 包装器后出现分段错误,请检查是否有任何残留的编译器标志或重新添加包装器


推荐阅读