编译Android SDK时遇到以下问题:
1. on-trivial designated initializers not supported
target thumb C++: gralloc.goldfish <= development/tools/emulator/opengl/system/gralloc/gralloc.cppdevelopment/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 supporteddevelopment/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, }}};