交叉编译qemu for android错误

时间:2018-06-10 14:13:29

标签: android cross-compiling qemu

我使用ndk-10e编译qemu2.5.0。我已经成功编译了glib for android。我的configure命令是:

PKG_CONFIG_PATH="$SYSROOT/usr/lib/pkgconfig" ./configure -- 
prefix="$SYSROOT/usr" --target-list=arm-linux-user --disable-system -- 
disable-bsd-user --disable-tools --disable-zlib-test --cross- 
prefix="arm-linux-androideabi-" --cc="$NDK/toolchains/arm-linux- 
androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc" - 
-host-cc="$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux- 
x86_64/bin/arm-linux-androideabi-gcc" --cpu="arm" -- 
cxx="$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux- 
x86_64/bin/arm-linux-androideabi-g++" --extra-ldflags="-fPIE -pie -- 
sysroot $SYSROOT -L$NDK/toolchains/arm-linux-androideabi- 
4.9/prebuilt/linux-x86_64/lib/gcc/arm-linux-androideabi/4.9/ - 
L$NDK/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi/ - 
L$NDK/platforms/android-21/arch-arm/usr/lib" --extra-cflags="-fPIE - 
pie --sysroot $SYSROOT -I$NDK/sources/cxx-stl/gnu- 
libstdc++/4.9/include -I$NDK/sources/cxx-stl/gnu- 
libstdc++/4.9/libs/armeabi/include -L$NDK/sources/cxx-stl/gnu- 
libstdc++/4.9/libs/armeabi/" --disable-guest-agent

当我输入" make"时,它会给我这个错误。


>   CHK version_gen.h
  CC    arm-linux-user/linux-user/syscall.o
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:374:16: error: static declaration of 'gettid' follows non-static declaration
 _syscall0(int, gettid)
                ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:303:13: note: in definition of macro '_syscall0'
 static type name (void)   \
             ^
In file included from /home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:27:0:
/home/sam/Documents/android-ndk-r10e/platforms/android-21/arch-arm/usr/include/unistd.h:57:15: note: previous declaration of 'gettid' was here
 extern pid_t  gettid(void) __pure2;
               ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'gettid':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:374:1: warning: implicit declaration of function 'syscall' [-Wimplicit-function-declaration]
 _syscall0(int, gettid)
 ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:374:1: warning: nested extern declaration of 'syscall' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'lock_iovec':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2050:30: error: 'IOV_MAX' undeclared (first use in this function)
     if (count  IOV_MAX) {
                              ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2050:30: note: each undeclared identifier is reported only once for each function it appears in
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'target_to_host_ipc_perm':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2703:12: error: 'struct ipc_perm' has no member named '__key'
     host_ip->__key = tswap32(target_ip->__key);
            ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2716:12: error: 'struct ipc_perm' has no member named '__seq'
     host_ip->__seq = tswap16(target_ip->__seq);
            ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'host_to_target_ipc_perm':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2731:39: error: 'struct ipc_perm' has no member named '__key'
     target_ip->__key = tswap32(host_ip->__key);
                                       ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2744:39: error: 'struct ipc_perm' has no member named '__seq'
     target_ip->__seq = tswap16(host_ip->__seq);
                                       ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: At top level:
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2815:7: error: redefinition of 'union semun'
 union semun {
       ^
In file included from /home/sam/Documents/android-ndk-r10e/platforms/android-21/arch-arm/usr/include/sys/sem.h:32:0,
                 from /home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:59:
/home/sam/Documents/android-ndk-r10e/platforms/android-21/arch-arm/usr/include/linux/sem.h:55:7: note: originally defined here
 union semun {
       ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'target_to_host_semarray':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2840:5: warning: implicit declaration of function 'semctl' [-Wimplicit-function-declaration]
     ret = semctl(semid, 0, IPC_STAT, semun);
     ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2840:5: warning: nested extern declaration of 'semctl' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_semop':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3002:5: warning: implicit declaration of function 'semop' [-Wimplicit-function-declaration]
     return get_errno(semop(semid, sops, nsops));
     ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3002:5: warning: nested extern declaration of 'semop' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'target_to_host_msqid_ds':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3041:12: error: 'struct msqid_ds' has no member named '__msg_cbytes'
     host_md->__msg_cbytes = tswapal(target_md->__msg_cbytes);
            ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'host_to_target_msqid_ds':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3062:46: error: 'struct msqid_ds' has no member named '__msg_cbytes'
     target_md->__msg_cbytes = tswapal(host_md->__msg_cbytes);
                                              ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_msgctl':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3114:9: warning: implicit declaration of function 'msgctl' [-Wimplicit-function-declaration]
         ret = get_errno(msgctl(msgid, cmd, &dsarg));
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3114:9: warning: nested extern declaration of 'msgctl' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_msgsnd':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3157:5: warning: implicit declaration of function 'msgsnd' [-Wimplicit-function-declaration]
     ret = get_errno(msgsnd(msqid, host_mb, msgsz, msgflg));
     ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3157:5: warning: nested extern declaration of 'msgsnd' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_msgrcv':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3177:5: warning: implicit declaration of function 'msgrcv' [-Wimplicit-function-declaration]
     ret = get_errno(msgrcv(msqid, host_mb, msgsz, msgtyp, msgflg));
     ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3177:5: warning: nested extern declaration of 'msgrcv' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_shmctl':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3302:9: warning: implicit declaration of function 'shmctl' [-Wimplicit-function-declaration]
         ret = get_errno(shmctl(shmid, cmd, &dsarg));
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3302:9: warning: nested extern declaration of 'shmctl' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_shmat':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3343:9: warning: implicit declaration of function 'shmat' [-Wimplicit-function-declaration]
         host_raddr = shmat(shmid, (void *)g2h(shmaddr), shmflg);
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3343:9: warning: nested extern declaration of 'shmat' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3343:20: warning: assignment makes pointer from integer without a cast
         host_raddr = shmat(shmid, (void *)g2h(shmaddr), shmflg);
                    ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3353:24: warning: assignment makes pointer from integer without a cast
             host_raddr = shmat(shmid, g2h(mmap_start), shmflg | SHM_REMAP);
                        ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_shmdt':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3391:5: warning: implicit declaration of function 'shmdt' [-Wimplicit-function-declaration]
     return get_errno(shmdt(g2h(shmaddr)));
     ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3391:5: warning: nested extern declaration of 'shmdt' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_ipc':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3413:9: warning: implicit declaration of function 'semget' [-Wimplicit-function-declaration]
         ret = get_errno(semget(first, second, third));
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3413:9: warning: nested extern declaration of 'semget' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3426:9: warning: implicit declaration of function 'msgget' [-Wimplicit-function-declaration]
         ret = get_errno(msgget(first, second));
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3426:9: warning: nested extern declaration of 'msgget' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3484:2: warning: implicit declaration of function 'shmget' [-Wimplicit-function-declaration]
  ret = get_errno(shmget(first, second, third));
  ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:3484:2: warning: nested extern declaration of 'shmget' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c: In function 'do_syscall':
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6241:13: warning: implicit declaration of function 'stime' [-Wimplicit-function-declaration]
             ret = get_errno(stime(&host_time));
             ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6241:13: warning: nested extern declaration of 'stime' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6318:13: warning: implicit declaration of function 'futimesat' [-Wimplicit-function-declaration]
             ret = get_errno(futimesat(arg1, path(p), tvp));
             ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6318:13: warning: nested extern declaration of 'futimesat' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6686:13: warning: implicit declaration of function 'sigorset' [-Wimplicit-function-declaration]
             sigorset(&set, &set, &cur_set);
             ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6686:13: warning: nested extern declaration of 'sigorset' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6870:13: warning: implicit declaration of function 'sigtimedwait' [-Wimplicit-function-declaration]
             ret = get_errno(sigtimedwait(&set, &uinfo, puts));
             ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6870:13: warning: nested extern declaration of 'sigtimedwait' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6908:9: warning: implicit declaration of function 'sethostname' [-Wimplicit-function-declaration]
         ret = get_errno(sethostname(p, arg2));
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:6908:9: warning: nested extern declaration of 'sethostname' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:7627:9: warning: implicit declaration of function 'vhangup' [-Wimplicit-function-declaration]
         ret = get_errno(vhangup());
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:7627:9: warning: nested extern declaration of 'vhangup' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:7794:9: warning: implicit declaration of function 'setdomainname' [-Wimplicit-function-declaration]
         ret = get_errno(setdomainname(p, arg2));
         ^
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:7794:9: warning: nested extern declaration of 'setdomainname' [-Wnested-externs]
/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:9280:9: warning: implicit declaration of function 'readahead' [-Wimplicit-function-declaration]
         ret = get_errno(readahead(arg1, ((off64_t)arg3 

有一些奇怪的事情,比如

  

/home/sam/Documents/qemu-2.5.0/linux-user/syscall.c:2703:12:错误:' struct ipc_perm'没有名为' __ key'        host_ip-> __ key = tswap32(target_ip-> __ key);   我不知道如何解决它。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

这将是以下的混合物:

  • 2.5是QEMU的旧版本;你可能会遇到编译中的错误与更新/不同版本的libc已经修复上游。首先使用更新的版本。
  • 您正在构建针对Android libc(仿生)的构建,它不是经过测试或支持的libc构建的。与glibc(标准Linux libc)相比,它存在差异或特质,你需要改变QEMU来解决这些问题。

例如,关于__key的错误,问题是Bionic在struct ipc_perm" key"中命名了该字段的版本,而不是" __ key"。