From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ugy8m-0004z4-39 for qemu-devel@nongnu.org; Mon, 27 May 2013 10:11:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ugy8j-0005M1-G5 for qemu-devel@nongnu.org; Mon, 27 May 2013 10:11:11 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:34750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ugy8j-0005Le-6w for qemu-devel@nongnu.org; Mon, 27 May 2013 10:11:09 -0400 Received: by mail-pa0-f51.google.com with SMTP id lf10so5877728pab.10 for ; Mon, 27 May 2013 07:11:08 -0700 (PDT) Message-ID: <51A36976.80608@ozlabs.ru> Date: Tue, 28 May 2013 00:11:02 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1369635195-28279-1-git-send-email-aik@ozlabs.ru> In-Reply-To: Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu: fix out of tree cross compile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org On 05/27/2013 08:24 PM, Peter Maydell wrote: > On 27 May 2013 07:13, Alexey Kardashevskiy wrote: >> QEMU uses headers from source directory, however the "asm" symlink was >> created in the build directory what broke KVM stuff compilation. >> >> Signed-off-by: Alexey Kardashevskiy >> --- >> configure | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/configure b/configure >> index 5ae7e4a..9c3c5e5 100755 >> --- a/configure >> +++ b/configure >> @@ -4135,7 +4135,7 @@ if test "$linux" = "yes" ; then >> esac >> # For non-KVM architectures we will not have asm headers >> if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then >> - symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm >> + symlink "$source_path/linux-headers/asm-$linux_arch" $source_path/linux-headers/asm > > This is definitely wrong -- the asm symlink must be created > in the build tree, because you could have two build trees > which are building for different architectures and need > different symlink targets. (More generally, an out of tree > build should never create files in the source tree, because > the point of out of tree builds is to leave the source tree > in a pristine state.) Ok, ok. Then I'll post another patch in a a response to this. > What is the actual bug here? QEMU builds fine for me, because > the build directory is also in the include path via "-I.". Does you build directory beside inside the source tree directory? I cannot see the other way for it to work. -I /linux-headers must be added, "-I." is not enough. The actual bug is that it does not cross compile until I apply this or the other patch. This is how I run ./configure: /home/alexey/pcipassthru/qemu-impreza/configure --source-path=/home/alexey/pcipassthru/qemu-impreza --target-list=ppc64-softmmu --cpu=ppc64 --cross-prefix=powerpc64-linux- --prefix=/home/alexey/pcipassthru/lib4qemu/install --extra-ldflags=-L/home/alexey/pcipassthru/lib4qemu/usr/lib64 '--extra-cflags=--sysroot=/home/alexey/pcipassthru/lib4qemu/ -I/home/alexey/pcipassthru/lib4qemu/usr/include -D__EXCEPTIONS -D__LONG_DOUBLE_128__ -D__NO_INLINE__ -Wno-redundant-decls -Wno-missing-prototypes -Wmissing-include-dirs' --disable-werror --enable-fdt --enable-attr --enable-kvm --enable-profiler --disable-seccomp --enable-trace-backend=stderr --enable-debug --disable-debug-tcg --enable-debug-info This is where the compilation fails on: powerpc64-linux-gcc \ -I/home/alexey/pcipassthru/qemu-impreza/tcg -I/home/alexey/pcipassthru/qemu-impreza/tcg/ppc64 -I/home/alexey/pcipassthru/qemu-impreza/linux-headers -I. -I/home/alexey/pcipassthru/qemu-impreza -I/home/alexey/pcipassthru/qemu-impreza/include -I/home/alexey/pcipassthru/qemu-impreza/target-ppc -Itarget-ppc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing --sysroot=/home/alexey/pcipassthru/lib4qemu/ -I/home/alexey/pcipassthru/lib4qemu/usr/include -D__EXCEPTIONS -D__LONG_DOUBLE_128__ -D__NO_INLINE__ -Wno-redundant-decls -Wno-missing-prototypes -Wmissing-include-dirs -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -I/home/alexey/pcipassthru/lib4qemu/usr/include -I/home/alexey/pcipassthru/lib4qemu/usr/include/p11-kit-1 -I/home/alexey/pcipassthru/lib4qemu/usr/include -I/home/alexey/pcipassthru/lib4qemu/usr/include/libusb-1.0 -I/home/alexey/pcipassthru/lib4qemu/usr/include -I/home/alexey/pcipassthru/lib4qemu/usr/include/pixman-1 -I../linux-headers -I.. -I/home/alexey/pcipassthru/qemu-impreza/target-ppc -DNEED_CPU_H -I/home/alexey/pcipassthru/qemu-impreza/include -pthread -I/home/alexey/pcipassthru/lib4qemu/usr/include/glib-2.0 -I/home/alexey/pcipassthru/lib4qemu/usr/lib64/glib-2.0/include -MMD -MP -MT target-ppc/kvm.o -MF target-ppc/kvm.d -g -I/home/alexey/pcipassthru/lib4qemu/usr/include -c -o target-ppc/kvm.o /home/alexey/pcipassthru/qemu-impreza/target-ppc/kvm.c /home/alexey/pcipassthru/qemu-impreza/hw/ppc/xics.c: In function 'icp_get_kvm_state': /home/alexey/pcipassthru/qemu-impreza/hw/ppc/xics.c:186:15: error: 'KVM_REG_PPC_ICP_STATE' undeclared (first use in this function) .id = KVM_REG_PPC_ICP_STATE, ^ ... -- Alexey