Qemu and Wine on ARM v7 (beaglebone black wireless)

Questions about Wine on Linux
Locked
Flabou
Level 1
Level 1
Posts: 7
Joined: Tue Jul 10, 2018 4:54 am

Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Flabou »

Hello everyone,
I am trying to install qemu on a beaglebone black wireless, following this answer by bernhardu in a previous topic, which unfortunatelly has been locked.
It seems like the procedure described worked for someone on a beaglebone black however I am stuck at compiling the program. When I try to run the make command, I get the following error :

Code: Select all

In file included from /home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/                                                                                                              qemu/qemu_1.4.0/include/qemu-common.h:15:0,
                 from block/qcow2-snapshot.c:25:
block/qcow2-snapshot.c: In function ‘qcow2_write_snapshots’:
/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/includ                                                                                                              e/qemu/compiler.h:36:23: error: typedef ‘qemu_build_bug_on__250’ locally define                                                                                                              d but not used [-Werror=unused-local-typedefs]
     typedef char cat2(qemu_build_bug_on__,__LINE__)[(x)?-1:1];
                       ^
/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/includ                                                                                                              e/qemu/compiler.h:33:18: note: in definition of macro ‘cat’
 #define cat(x,y) x ## y
                  ^
/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/includ                                                                                                              e/qemu/compiler.h:36:18: note: in expansion of macro ‘cat2’
     typedef char cat2(qemu_build_bug_on__,__LINE__)[(x)?-1:1];
                  ^~~~
block/qcow2-snapshot.c:249:5: note: in expansion of macro ‘QEMU_BUILD_BUG_ON’
     QEMU_BUILD_BUG_ON(offsetof(QCowHeader, snapshots_offset) !=
     ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/rules.                                                                                                              mak:21: recipe for target 'block/qcow2-snapshot.o' failed
make: *** [block/qcow2-snapshot.o] Error 1
My knowledge of linux is limited and I have notions of C but not in this context. I was able to do everything up to the "git reset --hard v1.4.0" command, but the patch didn't work properly because there was some difference in the syscall.c file compared to what the patch file contained, so I applied them by manually changing the lines, but I received this error nonetheless.

I don't understand why I have something different, which requires me to apply the patch manually while I did exactly like everyone else.

Any help would be appreciated.
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by DarkShadow44 »

Did you already try to jsut remove the warning? Either my editing code, or not treating warnings as errors.
Flabou
Level 1
Level 1
Posts: 7
Joined: Tue Jul 10, 2018 4:54 am

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Flabou »

Thank you for your answer. After posting I did try to add --disable-warning as an argument to ./configure. It seem to have compiled even though I had lots of warnings during the process such as :

Code: Select all

/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/linux-user/qemu.h:314:13: warning: right-hand operand of comma expression has no effect [-Wu                        nused-value]
   ((x) = (typeof(*hptr))(                                               \
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    __builtin_choose_expr(sizeof(*(hptr)) == 1, ldub_p,                  \
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    __builtin_choose_expr(sizeof(*(hptr)) == 2, lduw_##e##_p,            \
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    __builtin_choose_expr(sizeof(*(hptr)) == 4, ldl_##e##_p,             \
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    __builtin_choose_expr(sizeof(*(hptr)) == 8, ldq_##e##_p, abort))))   \
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      (hptr)), 0)
      ~~~~~~~^~~~
/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/linux-user/qemu.h:321:31: note: in expansion of macro ‘__get_user_e’
 # define __get_user(x, hptr)  __get_user_e(x, hptr, le)
                               ^~~~~~~~~~~~
/home/debian/qemu/qemu-git_2013-03-23_v1.4.0+ntpl+static/qemu/qemu_1.4.0/linux-user/signal.c:623:9: note: in expansion of macro ‘__get_user’
         __get_user(k->sa_restorer, &act->sa_restorer);
         ^~~~~~~~~~
But I don't think they matter. I don't know for sure if the compilation went fine (but I have binary files).
I continued to the next step which is to create a chroot and I managed to go up to the step "DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot chroot-wheezy-i386 /debootstrap/debootstrap --second-stage"
which didn't work because of the chroot call.
By running chroot on its own it said /bin/bash was not found, and I found this answer which explained that lib and usr was missing, so I copied both folder from the root to the chroot folder, however I am not sure if this can be done in this case since the root is an arm architecture and the chroot an x86 architecture, but I don't know where else to acquire them.
After this I am able to run "chroot chroot-wheezy-i386 /debootstrap/debootstrap --second-stage" but it fails with the error :

Code: Select all

root@beaglebone:/home/debian# chroot chroot-wheezy-i386 /debootstrap/debootstrap --second-stage
I: Installing core packages...
W: Failure trying to run:  dpkg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.26_i386.deb
W: See //debootstrap/debootstrap.log for details (possibly the package /var/cache/apt/archives/base-passwd_3.5.26_i386.deb is at fault)
and the log seems to be empty.
Flabou
Level 1
Level 1
Posts: 7
Joined: Tue Jul 10, 2018 4:54 am

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Flabou »

I realised that the follwing instructions from the old topic were no longer active because I had to reboot :

Code: Select all

mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
        echo -1 > /proc/sys/fs/binfmt_misc/status
        echo ':i386:M::\x7fELF\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff:/usr/bin/qemu-i386-static:' > /proc/sys/fs/binfmt_misc/register
So I restarted from these steps (and without copying the folders /usr and /lib) and now I have an error "Segmentation fault" when I do chroot. I used the tool strace and I got the following results :

Code: Select all

root@beaglebone:/home/debian# strace chroot chroot-wheezy-i386 /debootstrap/debootstrap --second-stage
execve("/usr/sbin/chroot", ["chroot", "chroot-wheezy-i386", "/debootstrap/debootstrap", "--second-stage"], [/* 18 vars */]) = 0
brk(NULL)                               = 0x23e4000
uname({sysname="Linux", nodename="beaglebone", ...}) = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
mmap2(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6f29000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=63989, ...}) = 0
mmap2(NULL, 63989, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6ef5000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
open("/lib/arm-linux-gnueabihf/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\331e\1\0004\0\0\0"..., 512) = 512
lseek(3, 900076, SEEK_SET)              = 900076
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 2920) = 2920
lseek(3, 896524, SEEK_SET)              = 896524
read(3, "A4\0\0\0aeabi\0\1*\0\0\0\0057-A\0\6\n\7A\10\1\t\2\n\3\f"..., 53) = 53
fstat64(3, {st_mode=S_IFREG|0755, st_size=902996, ...}) = 0
mmap2(NULL, 972112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb6e07000
mprotect(0xb6ee0000, 61440, PROT_NONE)  = 0
mmap2(0xb6eef000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd8000) = 0xb6eef000
mmap2(0xb6ef2000, 9552, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb6ef2000
close(3)                                = 0
set_tls(0xb6f2b810, 0xb6f2bee8, 0xb6f2d050, 0xb6f2b810, 0xb6f2d050) = 0
mprotect(0xb6eef000, 8192, PROT_READ)   = 0
mprotect(0x43a000, 4096, PROT_READ)     = 0
mprotect(0xb6f2c000, 4096, PROT_READ)   = 0
munmap(0xb6ef5000, 63989)               = 0
brk(NULL)                               = 0x23e4000
brk(0x2405000)                          = 0x2405000
getcwd("/home/debian", 4096)            = 13
lstat64("/home/debian/chroot-wheezy-i386", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
chroot("chroot-wheezy-i386")            = 0
chdir("/")                              = 0
execve("/debootstrap/debootstrap", ["/debootstrap/debootstrap", "--second-stage"], [/* 18 vars */]) = 0
uname({sysname="Linux", nodename="beaglebone", ...}) = 0
brk(NULL)                               = 0x62357000
brk(0x62357d34)                         = 0x62357d34
set_tls(0x623574c0, 0xb6c, 0x38, 0x612fa108, 0x602f0a2c) = 0
set_tid_address(0x62357068)             = 2262
set_robust_list(0x62357070, 12)         = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x600edd39, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x600fac51}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x600eddd9, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x600fac51}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
readlink("/proc/self/exe", 0xbec495c8, 4096) = -1 ENOENT (No such file or directory)
brk(0x62378d34)                         = 0x62378d34
brk(0x62379000)                         = 0x62379000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_ACCERR, si_addr=0x6010d243} ---
+++ killed by SIGSEGV +++
Segmentation fault
but I am not sure what to look for next.
User avatar
DarkShadow44
Level 8
Level 8
Posts: 1207
Joined: Tue Nov 22, 2016 5:39 pm

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by DarkShadow44 »

You could try a different repository for debootstrap, like suggested here
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Bob Wya »

@Flabou,

You're trying to work with a really ancient, 4 year-old guide.
Why not take a look at Stefan Dösinger and André Hentschel's work at: Github: AndreRH / hangover.

There was a talk about this project at this years Wineconf (and last years)...
It is under very active development.

Bob
Flabou
Level 1
Level 1
Posts: 7
Joined: Tue Jul 10, 2018 4:54 am

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Flabou »

@DarkShadow44
I can't use the raspbian repository as my goal is to emulate an x86 system. Is there a way to understand what causes the segmentation fault issue?

@Bob Wya
Thank you, I didn't know about this, however it seems like it only works on 64bits arm, and the beaglebone black uses a 32bits processor, and I am not skilled enough to make it work on 32bits.
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Bob Wya »

Thank you, I didn't know about this, however it seems like it only works on 64bits arm, and the beaglebone black uses a 32bits processor, and I am not skilled enough to make it work on 32bits.
Ah yes... Sorry I haven't tried playing around with any Arm boards (so I forget the majority are still 32-bit)...
You could always raise an Issue on Andre's Github page about 32-bit Arm support.

Andre said he was planning on using Arm's additional registers to improve the performance of Qemu for x86 to Arm translation (which does a lot of load-store calls, hammering the CPU cache).
I think the support for Arm64 was purely to reduce the complexity of the project, rather than it being technically any more difficult (but I can't remember this part specically!)

Bob
Flabou
Level 1
Level 1
Posts: 7
Joined: Tue Jul 10, 2018 4:54 am

Re: Qemu and Wine on ARM v7 (beaglebone black wireless)

Post by Flabou »

Apparently an issue like this has already been raised but Stefan Dösinger has said he wasn't actively working on it unfortunatelly. I'm going to try again with the old guide, with an older version of debian as well.
Locked