1.报错内容如下:
[651/2712] Compiling C object libqemuutil.a.p/util_vhost-user-server.c.o
FAILED: libqemuutil.a.p/util_vhost-user-server.c.o
aarch64-linux-android33-clang -Ilibqemuutil.a.p -I. -I.. -Isubprojects/libvhost-user -I../subprojects/libvhost-user -Iqapi -Itrace -Iui -Iui/shader -I/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -I/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/glib-2.0 -I/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/glib-2.0/include -I/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/gio-unix-2.0 -I/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/pixman-1 -fcolor-diagnostics -Wall -Winvalid-pch -std=gnu11 -O2 -g -isystem /home/dubu/myinstall/qemu-7.0.0/linux-headers -isystem linux-headers -iquote . -iquote /home/dubu/myinstall/qemu-7.0.0 -iquote /home/dubu/myinstall/qemu-7.0.0/include -iquote /home/dubu/myinstall/qemu-7.0.0/disas/libvixl -iquote /home/dubu/myinstall/qemu-7.0.0/tcg/aarch64 -pthread -Wno-unused-function -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv -Wold-style-definition -Wtype-limits -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wempty-body -Wnested-externs -Wendif-labels -Wexpansion-to-defined -Wno-initializer-overrides -Wno-missing-include-dirs -Wno-shift-negative-value -Wno-string-plus-int -Wno-typedef-redefinition -Wno-tautological-type-limit-compare -Wno-psabi -fstack-protector-strong -fPIE -Wno-unused-function -MD -MQ libqemuutil.a.p/util_vhost-user-server.c.o -MF libqemuutil.a.p/util_vhost-user-server.c.o.d -o libqemuutil.a.p/util_vhost-user-server.c.o -c ../util/vhost-user-server.c
In file included from ../util/vhost-user-server.c:10:
In file included from /home/dubu/myinstall/qemu-7.0.0/include/qemu/osdep.h:82:
In file included from /home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/stdint.h:32:
In file included from /home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/wchar_limits.h:36:
In file included from /home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/sys/cdefs.h:373:
/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/api-level.h:174:47: warning: this function declaration is not a prototype [-Wstrict-prototypes]
int android_get_application_target_sdk_version() __INTRODUCED_IN(24);
^
void
/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/android/api-level.h:194:33: warning: this function declaration is not a prototype [-Wstrict-prototypes]
int android_get_device_api_level() __INTRODUCED_IN(29);
^
void
In file included from ../util/vhost-user-server.c:12:
In file included from /home/dubu/myinstall/qemu-7.0.0/include/qemu/vhost-user-server.h:20:
In file included from /home/dubu/myinstall/qemu-7.0.0/include/standard-headers/linux/virtio_blk.h:31:
/home/dubu/myinstall/qemu-7.0.0/include/standard-headers/linux/virtio_types.h:44:19: error: typedef redefinition with different types ('uint64_t' (aka 'unsigned long') vs '__u64' (aka 'unsigned long long'))
typedef uint64_t __virtio64;
^
/home/dubu/myinstall/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/linux/virtio_types.h:24:25: note: previous definition is here
typedef __u64 __bitwise __virtio64;
^
2 warnings and 1 error generated.
ninja: build stopped: subcommand failed.
make: *** [Makefile:163:run-ninja] 错误 1
2.修改方法可参考如下连接
http://t.csdn.cn/lJbnw
这里要把qemu目录下的头文件virtio_types.h的宏定义修改为_UAPI_LINUX_VIRTIO_RING_H。
如果把$SYSROOT/usr/include/linux(即NDK-r25)下的头文件 virtio_types.h宏定义修改为_LINUX_VIRTIO_TYPE_H问题还是存在的。这个我不知道为什么?有大神的话清赐教。