root@WJHWPC:/home# arm-rockchip830-linux-uclibcgnueabihf-gcc test.c
In file included from test.c:2:
test.c:17:15: error: expected declaration specifiers or '...' before '__builtin_offsetof'
static_assert(offsetof(struct Foo, a) == 0, "First element of struct does not have offset 0");
^~~~~~~~
test.c:17:45: error: expected declaration specifiers or '...' before string constant
static_assert(offsetof(struct Foo, a) == 0, "First element of struct does not have offset 0");
arm-rockchip830-linux-uclibcgnueabihf-gcc lacks support for C11 static assertions.
交叉编译工具不支持C11,怎么办?
Compiler lacks support for C11 static assertions
您好,arm-rockchip830-linux-uclibcgnueabihf-gcc 是由 Rockchip 提供的交叉编译工具,主要是用来编译内核和适用于RV1103/RV1106的rockit库,buildroot也使用该交叉编译工具来确保软件的兼容性,所以通常情况下我们不会对其修改或升级。
针对您的问题有三种解决方案:
1 换其他支持C11的uclibc交叉编译工具单独编译您写的测试程序,如果有涉及到第三方链接库的话最好重新编译库
2 换用 ubuntu 系统,glibc 交叉编译工具的兼容性更好
3 手动定义一个 static_assert
针对您的问题有三种解决方案:
1 换其他支持C11的uclibc交叉编译工具单独编译您写的测试程序,如果有涉及到第三方链接库的话最好重新编译库
2 换用 ubuntu 系统,glibc 交叉编译工具的兼容性更好
3 手动定义一个 static_assert