Difference between revisions of "Building MINGW-w64"

From ReactOS Wiki
Jump to: navigation, search
(Getting the sources)
(Building binutils)
Line 46: Line 46:
  
 
From the build directory run the binutils configure script:
 
From the build directory run the binutils configure script:
  ../../src/binutils-2.20/configure --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32
+
  ../../src/binutils/configure --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32
 
   --with-sysroot=/RosBE64  --prefix=/RosBE64
 
   --with-sysroot=/RosBE64  --prefix=/RosBE64
  

Revision as of 19:44, 6 April 2010

... for idiots. This guide is provided for those who have no clue how to compile gcc, but still want to do it. It's a reference, just follow the steps and you get what you want. There's no support for special wishes ;-)

Setting up the build environment

  • Download cygwin setup from here: [1]
  • Run the installer and select the target directory. Choose something short and without spaces, like c:\cygwin\
  • Add the following components:
    • Devel:
      • binutils
      • bison
      • flex
      • gcc4-core
      • gcc4-g++
      • make (3.81 or newer)
    • Libs:
      • gmp
      • libgmp-devel
      • libgmp3
      • libgmpxx4
      • libiconv
      • libmpfr-devel
      • libmpfr1
      • mpfr

Start the cygwin shell. You should be in a folder like /home/YourName. If YourName is a path that has a space in it, I suggest to use a different one. Also create a folder for the sources and a build folder.

mkdir src
mkdir build

Getting the sources

Download all the sources into subfolders of /home/YourName/src

  • binutils -> home/YourName/src/binutils
  • gcc-core + gcc-g++ -> home/YourName/src/gcc
  • mingw-w64

Building

Building binutils

Create a build subdirectory for binutils:

cd build
mkdir binutils
cd binutils

From the build directory run the binutils configure script:

../../src/binutils/configure --target=x86_64-w64-mingw32 --enable-targets=x86_64-w64-mingw32,i686-w64-mingw32
  --with-sysroot=/RosBE64  --prefix=/RosBE64

Now build the whole stuff.

make

Finally install it into the designated directory.

make install

Add Mingw-w64 header set

Copy the mingw-w64/include directory to /RosBE64/x86_64-w64-mingw32

Create a symlink for gcc.

ln -s /RosBE64/x86_64-w64-mingw32 /RosBE64/mingw'

If the /RosBE64/x86_64-w64-mingw32/lib directory doesn't exist yet, create it:

mkdir  /RosBE64/x86_64-w64-mingw32/lib

Create symlink for lib directory, too:

ln -s /RosBE64/x86_64-w64-mingw32/lib /RosBE64/x86_64-w64-mingw32/lib64

Building gcc

Emter into the build directory:

cd ..
mkdir gcc
cd gcc

Now run the configure script:

../../src/gcc-4.4.3/configure --target=x86_64-w64-mingw32 --prefix=/RosBE64 --with-sysroot=/RosBE64 
 --enable-languages=c,c++

Compile

make

And install

make install