交叉编译配置命令如下:

PKG_CONFIG_PATH="$SYSROOT/usr/lib/pkgconfig" ../configure --prefix=/home/dubu/installtest --target-list=aarch64-softmmu --cpu=aarch64 --cross-prefix=aarch64-linux-android33- --cc=aarch64-linux-android33-clang --cxx=aarch64-linux-android33-clang++ --host-cc=aarch64-linux-android33-gcc

make的时候报的错误,configure的时候没有问题

1.报错内容如下

[66/2776] Compiling C object subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o
FAILED: subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o 
aarch64-linux-android33-clang -Isubprojects/libvhost-user/libvhost-user.a.p -Isubprojects/libvhost-user -I../subprojects/libvhost-user -fcolor-diagnostics -Wall -Winvalid-pch -std=gnu99 -O2 -g -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 -pthread -D_GNU_SOURCE -MD -MQ subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -MF subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o.d -o subprojects/libvhost-user/libvhost-user.a.p/libvhost-user.c.o -c ../subprojects/libvhost-user/libvhost-user.c
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
In file included from ../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:36:
../subprojects/libvhost-user/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/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_types.h:24:25: note: previous definition is here
typedef __u64 __bitwise __virtio64;
                        ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:95:8: error: redefinition of 'vring_desc'
struct vring_desc {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:40:8: note: previous definition is here
struct vring_desc {
       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:106:8: error: redefinition of 'vring_avail'
struct vring_avail {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:46:8: note: previous definition is here
struct vring_avail {
       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:113:8: error: redefinition of 'vring_used_elem'
struct vring_used_elem {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:51:8: note: previous definition is here
struct vring_used_elem {
       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:123:8: error: redefinition of 'vring_used'
struct vring_used {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:56:8: note: previous definition is here
struct vring_used {
       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:150:8: error: redefinition of 'vring'
struct vring {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:64:8: note: previous definition is here
struct vring {
       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:189:9: warning: 'vring_avail_event' macro redefined [-Wmacro-redefined]
#define vring_avail_event(vr) (*(__virtio16 *)&(vr)->used->ring[(vr)->num])
        ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:72:9: note: previous definition is here
#define vring_avail_event(vr) (* (__virtio16 *) & (vr)->used->ring[(vr)->num])
        ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:191:20: error: redefinition of 'vring_init'
static inline void vring_init(struct vring *vr, unsigned int num, void *p,
                   ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:74:24: note: previous definition is here
static __inline__ void vring_init(struct vring *vr, unsigned int num, void *p,
                       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:201:24: error: redefinition of 'vring_size'
static inline unsigned vring_size(unsigned int num, unsigned long align)
                       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:84:28: note: previous definition is here
static __inline__ unsigned vring_size(unsigned int num, unsigned long align)
                           ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:214:19: error: redefinition of 'vring_need_event'
static inline int vring_need_event(uint16_t event_idx, uint16_t new_idx, uint16_t old)
                  ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:95:23: note: previous definition is here
static __inline__ int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
                      ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:224:8: error: redefinition of 'vring_packed_desc_event'
struct vring_packed_desc_event {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:105:8: note: previous definition is here
struct vring_packed_desc_event {
       ^
In file included from ../subprojects/libvhost-user/libvhost-user.c:45:
In file included from ../subprojects/libvhost-user/libvhost-user.h:23:
../subprojects/libvhost-user/standard-headers/linux/virtio_ring.h:231:8: error: redefinition of 'vring_packed_desc'
struct vring_packed_desc {
       ^
/home/dubu/android-ndk-r25/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/include/linux/virtio_ring.h:109:8: note: previous definition is here
struct vring_packed_desc {
       ^
1 warning and 11 errors generated.
ninja: build stopped: subcommand failed.
make: *** [Makefile:163:run-ninja] 错误 1

上面出现了那么多的重定义,那么为什么正常编译(就是在本地电脑编译,不是交叉编译)的时候就没有出现这么多重定义。其实正常编译的时候用的头文件都是/usr/include/linux该目录下的头文件,该目录下的头文件与qemu目录下的头文件的宏定义是一模一样,所以包了/usr/include/linux该目录下的头文件以后就不会再包含qemu目录下的头文件。而我们交叉编译的时候用的是$SYSROOT/usr/include/linux下的头文件,该目录下头文件的宏定义与qemu目录下的头文件的宏定义不一样所以会出现重复定义的情况。所以我们需要修改qemu目录下的头文件的宏定义。

以virtio_ring.h为例子:

/usr/include/linux/virtio_ring.h的宏定义为:

#ifndef _LINUX_VIRTIO_RING_H
#define _LINUX_VIRTIO_RING_H

qemu目录下的头文件virtio_ring.h的宏定义 为:

#ifndef _LINUX_VIRTIO_RING_H
#define _LINUX_VIRTIO_RING_H

$SYSROOT/usr/include/linux下的头文件 virtio_ring.h宏定义 为:

#ifndef _UAPI_LINUX_VIRTIO_RING_H
#define _UAPI_LINUX_VIRTIO_RING_H

所以把出现redifine报错的的文件的宏修改以下就可以了。

这里要把qemu目录下的头文件virtio_ring.h的宏定义修改为_UAPI_LINUX_VIRTIO_RING_H。

如果把$SYSROOT/usr/include/linux(即NDK-r25)下的头文件 virtio_ring.h宏定义修改为_LINUX_VIRTIO_RING_H问题还是存在的。这个我不知道为什么?有大神的话清赐教。

NDK-r25交叉编译qemu-7.0.0 第66步报错相关推荐

  1. tensorflow1.14.0安装不上,报错

    pip install tensorflow==1.14.0 -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow1.14.0安装不上,报错 M ...

  2. Redis 5.0.3默认配置启动报错解决方法

    Redis 5.0.3默认配置启动报错解决方法 参考文章: (1)Redis 5.0.3默认配置启动报错解决方法 (2)https://www.cnblogs.com/miclesvic/p/1031 ...

  3. MyEclipse导入jquery-1.8.0.min.js等文件报错的解决方案

    2019独角兽企业重金招聘Python工程师标准>>> MyEclipse导入jquery-1.8.0.min.js等文件报错的解决方案 MyEclipse导入jquery-1.8. ...

  4. webview在android8.0,解决Android8.0系统应用打开webView报错

    由于webView存在安全漏洞,谷歌从5.1开始全面禁止系统应用使用webview,使用会导致应用崩溃错误提示:Caused by: java.lang.UnsupportedOperationExc ...

  5. mysql 8.0.21 对用户授权报错 near ‘IDENTIFIED BY ‘123456‘ with grant option‘ at line 1

    mysql 8.0.21 对用户授权报错 near 'IDENTIFIED BY '123456' with grant option' at line 1 问题描述 mysql在创建用户,对用户授权 ...

  6. 安装Saas芸众商城系统后提示:{“result“:0,“msg“:““,“data“:{“status“:-4}}报错的原因

    安装Saas芸众商城系统至尊版所遇到的坑我想你也踩过,总结出来! 安装宝塔,本文是用的是lamp,可以酌情考虑. 放入代码和数据库. php使用7.4版本,安装 ionCube, fileinfo, ...

  7. 解决交叉编译连接器包含-ldl编译选项,但仍然报错undefined reference to ‘__dlsym‘

    交叉编译连接器包含-ldl编译选项,但仍然报错undefined reference to '__dlsym' 文章目录 交叉编译连接器包含-ldl编译选项,但仍然报错undefined refere ...

  8. NDK-r25交叉编译qemu-7.0.0 第651步报错

    1.报错内容如下: [651/2712] Compiling C object libqemuutil.a.p/util_vhost-user-server.c.o FAILED: libqemuut ...

  9. IPython 8.0大版本更新:Debug报错提示更清晰,加入自动代码补全

    鱼羊 发自 凹非寺 量子位 | 公众号 QbitAI 酝酿了3年多,IPython 8.0终于来了. 现在,用上最新版本,你不仅能在命令行里使用Black重新格式化代码,还能获得更好的自动代码补全和D ...

最新文章

  1. 如何在python中制作超级玛丽_教你利用Python写一款超级玛丽,零基础也能学会,超级装逼...
  2. 智联招聘爬虫源码分析(一)
  3. PTA团体程序设计天梯赛篇(五)---- 难题篇一(30分题目)
  4. 计算机水平考试模拟卷,计算机等级考试模拟题
  5. win7 php 5.3,win7 64位 WAMP环境下(PHP5.3) redis扩展无法生效
  6. linux降内核版本_ubuntu16.04降级内核版本至3.13.0-85
  7. .NET生态系统概览
  8. LOJ 3156: 「NOI2019」回家路线
  9. YARN作业提交流程剖析
  10. FFmpeg Android 学习(一):Android 如何调用 FFMPEG 编辑音视频
  11. 浏览器是如何工作的系列:页面布局
  12. 防止浏览器记住用户名及密码的简单实用方法
  13. 博途v14电脑要求_博图TIA V14版本完整体验加测试
  14. 汇川机器人视觉标定_汇川机器人应用技术课件(1).ppt
  15. 第二周——学习内存取证神器volatility的使用
  16. Python计算时间差天数
  17. 赛灵思 Xilinx Versal 自适应计算加速平台嵌入式设计教程
  18. carla创建地图(四)基于ue4创建地图
  19. 最全4k,8k的高清壁纸网站免费下载
  20. zabbix之3触发器/action及模板

热门文章

  1. 2018年终总结(兼个人详历) | 2018 与我的技术之路
  2. FPGA简单全加器设计
  3. Vue CLI 3结合Lerna进行UI框架设计
  4. POJ 1318 Word Amalgamation G++
  5. 华为任正非:实事求是的科研方向与二十年的艰苦努力
  6. 什么是 Linux 发行版?为什么它被称为“发行版”
  7. vscode中converting to execution character set: Illegal byte sequence
  8. Burpsuite工具与浏览器之间设置代理、安装证书
  9. python算法专项(六)——Tensorflow原理基础,三层网络
  10. keras交通信号识别(分类)