Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Info
  3. Community
  4. Development
  5. myReactOS


Your Ad Here

ReactOS Community > ReactOS Wiki

Compiling GCC From Windows

From ReactOS

Jump to: navigation, search

This page will help guide you through compiling a gnu tool chain in windows for windows. When compiling ReactOS you should always use the ReactOS Build Environment. This is here, mainly, to facilitate rosbe windows updates.

Contents

Before you start

Needed tools

Needed source code


Preparing the source code

You should have, at least, the following directories in your root working directory (in this case C:\source)

Note: Placing the gmp and mpfr package along side gcc, as shown, will cause gcc to compile them automatically, else you will have to configure, make and install them separately.

  • binutils
  • cloog-ppl(optional)
  • gcc
    • gmp
    • mpfr
  • mingw
    • mingw-crt
    • mingw-headers

At this point we should be ready to start configuring and compiling our toolchain. Fire up the msys prompt, you should check you have gcc, make, flex and all the other tools required before starting.

Configure flags

GCC configure flags

This document does not and cannot address the meaning of every single configure flag, please check the gcc manual and google for more information. The following flags deserve some explanation.

host/target

The triplet or alias representing the architecture we want to compile for. In our case we are building with host "mingw32" and target "mingw32". See the full list for other options.

prefix

In our case, in the msys environment, the system root is the msys installation directory. With --prefix=C:\rosbe\i586 the "make install" command will put its binaries in "C:\msys\1.0\i386" (assuming standard installation).

Configure and compile

If you're lucky enough, you could copy paste the following code sections into your msys console and get a nice toolchain. ReactOS minimum CPU requirement is pentium.

export CFLAGS="-O2 -mtune=pentium -march=i586"
export CXXFLAGS="$CFLAGS"
export LDFLAGS=-s

Binutils

cd binutils
./configure --prefix=C:/rosbe/i586 --host=mingw32 --build=mingw32 --target=mingw32
make
make install

GCC

cd ../gcc
./configure --prefix=C:/rosbe/i586 --build=mingw32 --host=mingw32 --target=mingw32 --enable-languages=c,c++ \
--disable-win32-registry --enable-sjlj-exceptions --enable-threads=win32 --enable-checking=release
make
make install

Headers and Runtime

#headers
cd ../mingw/w32api
cp -R . C:/rosbe/i586/mingw32

#runtime
cd ../mingwrt
./configure --prefix=C:/rosbe/i586 --host=mingw32 --build=mingw32 --target=mingw32
make install

#symlink
cd ../../gcc
ln -s C:/rosbe/i586/ winsup


Testing (optional)

Troubleshooting

Cleaning

Sometimes, after and error has occurred, especially if you must go back and change configure settings it is necessary to run these commands:

#delete generated files
make clean
#delete configure generated files
make distclean