[vbox-dev] Building VirtualBox for windows amd64

Klaus Espenlaub Klaus.Espenlaub at Sun.COM
Wed Sep 3 12:53:28 GMT 2008


vbox wrote:
>> I have been struggling a week on and off to build VirtualBox OSE for
>> amd64/Windows. I have fixed configure.vbs so it handles libxml2, libxslt
>> and qt4. For gcc compiling I have used the mingw_x86_64 build invironment
>> that provides a toolchain that targets x86_64-pc-mingw32. This actually
>> seems to work fine all the way to the recompiler subdir.
>> I can see the toolchain used by VirtualBox developers to build the
>> amd64/windows version is called x86_64-unknown-linux-gnu-<tool>.exe. And
>> is
>> a gcc version 3.4.6. I have been trying to build this exact version and
>> target all weekend but with no luck (I can build binutils and half of
> gcc,
>> then it fails).
>>
>> VirtualBox developers: Please, could you be so kind as to expose the
>> x86_64-unknown-linux-gnu toolchain you are using, that would really ease
>> the build process. An idea could be to add it to the svn repository under
>> the tools directory - it would still be nessecary to download the mingw
>> environment besides.
>>
>> Here is where my virtualbox build ends:
>>
>> kBuild: Installing VBoxREM =>
>> C:/dev/vbox/out/win.amd64/release/bin/VBoxREM.dll
>> kBuild: Pass - Programs
>> kBuild: Compiling VBoxREM2 - C:/dev/vbox/src/recompiler/VBoxRecompiler.c
>> In file included from C:/dev/vbox/src/recompiler/VBoxRecompiler.c:28:
>> C:/dev/vbox/src/recompiler/exec-all.h: In function 'tb_add_jump':
>> C:/dev/vbox/src/recompiler/exec-all.h:308: warning: cast from pointer to
>> integer of different size
>> C:/dev/vbox/src/recompiler/exec-all.h:312: warning: cast from pointer to
>> integer of different size
>> C:/dev/vbox/src/recompiler/exec-all.h:312: warning: cast to pointer from
>> integer of different size
>>    .
>>    .
>>    .
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h: In function
>> 'op_punpckhwd_xmm':
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h:1400: warning: cast from
>> pointer to integer of different size
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h:1400: warning: cast from
>> pointer to integer of different size
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h: In function
>> 'op_punpckhdq_xmm':
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h:1400: warning: cast from
>> pointer to integer of different size
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h:1400: warning: cast from
>> pointer to integer of different size
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h: In function
>> 'op_punpckhqdq_xmm':
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h:1400: warning: cast from
>> pointer to integer of different size
>> C:/dev/vbox/src/recompiler/target-i386/ops_sse.h:1400: warning: cast from
>> pointer to integer of different size
>> kBuild: dyngen VBoxREM -
>> C:/dev/vbox/out/win.amd64/release/obj/VBoxREM2/target-i386/op.o
>> dyngen: bad ELF header
>> kmk: *** [C:/dev/vbox/out/win.amd64/release/obj/VBoxREM2/op.h] Error 1
>> kmk: *** Deleting file
>> `C:/dev/vbox/out/win.amd64/release/obj/VBoxREM2/op.h'
>>
>> The command that fails:
>> @C:/dev/mingw_x86_64_20080724/bin/gcc.exe -c -g -O2 -nostdinc
>> -fno-strict-aliasing -fno-math-errno -Wall -O2 -fno-strict-aliasing -m64
>> -mcmodel=medium -fno-common -O2 -IC:/dev/vbox/src/recompiler/Sun
>> -IC:/dev/vbox/src/recompiler/Sun/crt
>> -IC:/dev/vbox/src/recompiler/target-i386 -IC:/dev/vbox/src/recompiler/fpu
>> -IC:/dev/vbox/out/win.amd64/release/obj/VBoxREM2
>> -IC:/dev/vbox/src/VBox/VMM
>> -IC:/dev/vbox/src/recompiler -IC:/dev/vbox/include/iprt/nocrt
>> -IC:/dev/vbox/include -IC:/dev/vbox/out/win.amd64/release -DVBOX
>> -DVBOX_OSE
>> -DVBOX_WITH_64_BITS_GUESTS -DVBOX_WITH_INTERNAL_NETWORKING
> -DRT_OS_WINDOWS
>> -D__WIN__ -DRT_ARCH_AMD64 -D__AMD64__ -D__WIN64__ -DIN_RING3
> -DIPRT_NO_CRT
>> -DHC_ARCH_BITS=64 -DGC_ARCH_BITS=64 -DIN_REM_R3 -DREM_INCLUDE_CPU_H
>> -DREM_PHYS_ADDR_IN_TLB -DLOG_USE_C99 -DHC_ARCH_BITS=64 -DGC_ARCH_BITS=64
>>
> -Wp,-MD,C:/dev/vbox/out/win.amd64/release/obj/VBoxREM2/VBoxRecompiler.o.dep
>> -Wp,-MT,C:/dev/vbox/out/win.amd64/release/obj/VBoxREM2/VBoxRecompiler.o
>> -Wp,-MP -o
> C:/dev/vbox/out/win.amd64/release/obj/VBoxREM2/VBoxRecompiler.o
>>
>> The gcc toolchain I'm using targets x86_64-pc-mingw32 which is probably
>> part of the problem since it seems like dyngen expects ELF, also it is
> gcc
>> 4.4.0 and I can see in a comment at the top of the Makefile inside the
>> recompiler directory that versions >4 are not supported:
>>
>> C:\dev\vbox\src\recompiler>C:/dev/mingw_x86_64_20080724/bin/gcc.exe -v
>> Using built-in specs.
>> Target: x86_64-pc-mingw32
>> Configured with: ../gcc/configure --prefix=/var/tmp/win64
>> --with-sysroot=/var/tmp/win64 --target=x86_64-pc-mingw32 --host=x86_64-p
>> c-mingw32 -q --silent
>> Thread model: win32
>> gcc version 4.4.0 20080724 (experimental) (GCC)
> 
> Anyone?
> 
> Maybe just a short explaination on how you build the toolchain
> x86_64-unknown-linux-gnu for windows so I can do it myself.

It's a gcc+binutils toolchain configured for cross-compilation. Host 
platform is 32bit mingw, target platform is 64bit linux. The "linux" 
part of it is just partially relevant, what matters is that the object 
format is elf (building of the recompiler assumes that elf format). We 
used gcc 3.4.6 sources for this, simply because its known working with 
the recompiler sources. The normal patch for adapting gcc sources for 
building with mingw32 should do.

Klaus





More information about the vbox-dev mailing list