coLinux
Advertisement

Howto install MinGW-w64

Howto install toolchain on 64 bit Linux

You can download this install steps as complete script file from install-MinGW-for-64bit-under-Linux.sh

  • Lets start with a new (empty!) directory, I used "MinGW64" on my home.
  • Set some variables make this doc here more readable. DOWNLOADS and TOOLBASE you can set to somewhere. All other variables you should not change in your first try.
DOWNLOADS="$HOME/download"
TOOLBASE="$HOME/MinGW64"
PREFIX="$TOOLBASE/gcc445"
TARGET="x86_64-w64-mingw32"
  • Check your Linux machine type is 64 bit (x86_64) or not
uname -m
MINGW_PACK="mingw-w64-bin_i686-linux_20100604_sezero.tar.gz"
mkdir -p $DOWNLOADS
cd $DOWNLOADS
wget "http://sourceforge.net/projects/mingw-w64/files/Toolchains targetting Win64/Personal Builds/sezero_20100604/$MINGW_PACK/download"
  • "sezero" does not tar'ed from base of PREFIX. So, unpack this somewhere and set softlink
mkdir -p $TOOLBASE/sezero
cd $TOOLBASE/sezero
tar xzf $DOWNLOADS/$MINGW_PACK
ln -s sezero/W64_160271 $PREFIX
  • Download DDK headers from MinGW branch "experimental" via SVN and copy all files over the MinGW headers
svn checkout -r 2511 http://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/experimental/ddk_test $DOWNLOADS/MinGW64-ddk_test.svn
cp -a $DOWNLOADS/MinGW64-ddk_test.svn/include/* $PREFIX/$TARGET/include/
svn diff -c 2480 http://mingw-w64.svn.sourceforge.net/svnroot/mingw-w64/trunk/mingw-w64-headers >mingw64-sdkddkver.h-r2480.patch
  • Apply the patch over the headers:
patch -p0 -d $PREFIX/$TARGET <mingw64-sdkddkver.h-r2480.patch

If you loades the patch from SVN, the error from non exist ChangeLog you can ignore.

Howto check toolchain

Check, that DDK headers and Compiler can create objects

  • Create very small source
cd /tmp
echo "#include <ntddk.h>" >compiler.c
  • Set some more variables and build the object:
CFLAGS="-I$PREFIX/$TARGET/include/ddk -Wall -Os -O2"
PATH="$PATH:$PREFIX/bin"
$TARGET-gcc $CFLAGS -c -o compiler.o compiler.c
  • You should have no warnings and a file compiler.o now.
  • More tests you can get form gcc445-mingw-w64-ddk-testing-suite.tgz. There are included sources and binaries for loader and simple driver.
Advertisement