On 20 January 2017 at 15:21, Bilal Amarni <1658...@bugs.launchpad.net> wrote: > Hi, while trying to build qemu v2.8.0 with gcc-aarch64-linux-gnu cross- > compiler I'm getting the following : > > > In file included from /usr/include/x86_64-linux-gnu/sys/syscall.h:31:0, > from /root/qemu/util/compatfd.c:21: > /root/qemu/util/compatfd.c: In function 'qemu_signalfd': > /root/qemu/util/compatfd.c:103:19: error: '__NR_signalfd' undeclared (first > use in this function) > ret = syscall(SYS_signalfd, -1, mask, _NSIG / 8); > ^ > /root/qemu/util/compatfd.c:103:19: note: each undeclared identifier is > reported only once for each function it appears in > /root/qemu/rules.mak:59: recipe for target 'util/compatfd.o' failed > make: *** [util/compatfd.o] Error 1
You can see from the error message that the compile has pulled in the include file /usr/include/x86_64-linux-gnu/sys/syscall.h from the host, which is the x86-64 version. This is an indication that either your cross compiler is broken, or you're not using it at all. > ../configure --target-list=x86_64-linux-user --static --cpu=aarch64 You haven't told configure to use a cross compiler at all, so it is building with the x86 system compiler, which doesn't work. You shouldn't need to use the --cpu argument at all, because if you get the build to use the right compiler it can figure that out itself. (Passing --cpu=aarch64 tells configure "ignore the fact this is an x86 compiler and assume it's aarch64 instead", which just results in things breaking because that assumption is wrong.) You need to pass configure --cross-prefix=aarch64-linux-gnu- You'll also need to ensure you have an aarch64-linux-gnu-pkg-config and that you have cross versions of all QEMU's library dependencies (notably zlib and glib) in the right place that your cross-compiler can find them, and that your cross pkg-config is set up to point to them. On Ubuntu, you may find it easier to set up a cross-architecture chroot and do the build in that (where it looks like a native build). Cross-compilation of software with non-trivial dependencies is always an enormous pain in the neck. thanks -- PMM