Android make sdk出错问题的解决

本文详细介绍了在编译Android SDK时遇到的'非平凡指定初始化错误'问题,并提供了通过初始化结构体成员来解决该问题的方法。解决步骤包括识别错误源、理解错误含义以及在代码中添加缺失的初始化语句。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

编译Android SDK时遇到以下问题:

1. on-trivial designated initializers not supported

target thumb C++: gralloc.goldfish <= development/tools/emulator/opengl/system/gralloc/gralloc.cpp
development/tools/emulator/opengl/system/gralloc/gralloc.cpp: In function 'int gralloc_unregister_buffer(const gralloc_module_t*, buffer_handle_t)':
development/tools/emulator/opengl/system/gralloc/gralloc.cpp:583:26: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
development/tools/emulator/opengl/system/gralloc/gralloc.cpp: At global scope:
development/tools/emulator/opengl/system/gralloc/gralloc.cpp:900:1: sorry, unimplemented: non-trivial designated initializers not supported
development/tools/emulator/opengl/system/gralloc/gralloc.cpp:900:1: warning: missing initializer for member 'gralloc_module_t::reserved_proc' [-Wmissing-field-initializers]
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/gralloc.goldfish_intermediates/gralloc.o] Error 1


解决方法: 结构体的其中一个成员getphys未提供初始化,加上就ok了:

struct private_module_t HAL_MODULE_INFO_SYM = {
base: {
common: {
tag: HARDWARE_MODULE_TAG,
version_major: 1,
version_minor: 0,
id: GRALLOC_HARDWARE_MODULE_ID,
name: "Graphics Memory Allocator Module",
author: "The Android Open Source Project",
methods: &gralloc_module_methods,
dso: NULL,
reserved: {0, }
},
registerBuffer: gralloc_register_buffer,
unregisterBuffer: gralloc_unregister_buffer,
lock: gralloc_lock,
unlock: gralloc_unlock,
perform: NULL,
getphys: NULL,
reserved_proc : {NULL, }
}
};






评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值