User:Imate900/GDC Cross-Compiler-Part2: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
Content added Content deleted
m (Changed WIP to Stub: Author missing in action)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Step 2 - Native Compiler ==
== Step 2 - Native Compiler ==


{{Stub}}
Once you port [[Newlib]] to your OS (and install it to /usr/native), you may now do a native build of gdc to your OS.

Once you do everything in [[Porting Newlib]] to your OS (and install it to /usr/native), support ELF, and configure the packages to your OS, you may now do a native build of gdc to your OS.


Prepare for the build:
Prepare for the build:
Line 8: Line 10:
export HOST=i586-elf
export HOST=i586-elf
cd /usr/src
cd /usr/src
mkdir build-native build-native/binutils build-native/gcc</pre>
mkdir build-native build-native/binutils build-native/gcc


=== binutils ===
=== binutils ===
Line 17: Line 19:


=== gcc ===
=== gcc ===
cd /usr/src/gcc-x.x.x
./gcc/d/setup-gcc.sh

Go to /usr/src/gcc-x.x.x/gcc/d, open d-lang.cc and look at line 188.
You'll see this

const char* cygwin_d_os_versym = D_OS_VERSYM;

Change D_OS_VERSYM to whatever you want, since it is a string, like "MyOS".
(Wilkie told me not to set it to NULL, it will make the compiler to segfault)

Now build GDC:

cd /usr/src/build-native/gcc
cd /usr/src/build-native/gcc
/usr/src/gcc-x.x.x/configure --build=`./config.guess` --host=$HOST --target=$TARGET --prefix=$PREFIX --disable-nls \
/usr/src/gcc-x.x.x/configure --build=`./config.guess` --host=$HOST --target=$TARGET --prefix=$PREFIX --disable-nls \
--enable-languages=c,d,c++ --with-newlib
--enable-languages=c,d,c++ --with-headers=/usr/native
make all-gcc
make all-gcc
make install-gcc
make install-gcc


Your native toolchain is now ready in /usr/native!
Your native toolchain is now ready in /usr/native!

{{In Progress}}

Latest revision as of 14:51, 9 November 2009

Step 2 - Native Compiler

This page is a stub.
You can help the wiki by accurately adding more contents to it.

Once you do everything in Porting Newlib to your OS (and install it to /usr/native), support ELF, and configure the packages to your OS, you may now do a native build of gdc to your OS.

Prepare for the build:

   export PREFIX=/usr/native
   export TARGET=i586-elf
   export HOST=i586-elf
   cd /usr/src
   mkdir build-native build-native/binutils build-native/gcc

binutils

   cd /usr/src/build-native/binutils
   /usr/src/binutils-x.xx/configure --build=`./config.guess` --target=$TARGET --prefix=$PREFIX --host=$HOST --disable-nls
   make all
   make install

gcc

   cd /usr/src/build-native/gcc
   /usr/src/gcc-x.x.x/configure --build=`./config.guess` --host=$HOST --target=$TARGET --prefix=$PREFIX --disable-nls \
       --enable-languages=c,d,c++ --with-headers=/usr/native
   make all-gcc
   make install-gcc

Your native toolchain is now ready in /usr/native!