9. How to support C++ RTTI and exceptions on your hobby OS - WebKit porting to Mona OS

Where are we?

  1. building JavaScriptCore on Mona OS needs ICU
  2. ICU needs RTTI support
  3. Have to build libsupc++ to support RTTI <=== We are HERE

Requirements and assumptions

I explain here how to enable RTTI and exceptions on my hobby OS Mona.
We use mingw cross compiler for building our kernel and userland applications.
We used to set two CFLAGS -fno-exceptions and -fno-rtti when compiling applications. Since without the flags, we have many link errors.


Please read first following articles.

building libsupc++ and libgcc.

After you built Mingw gcc-4.6.1, configure and build libstdc++ which is in the gcc-4.6.1 directory.

% mkdir build-sup
% cd build-sup
% ../gcc-4.6.1/libstdc++-v3/configure --host=i586-mingw32msvc --prefix=/home/taro/ --disable-hosted-libstdcxx --disable-nls
% make && make install
% ls ~/lib/gcc/i586-mingw32msvc/4.6.1
crtbegin.o  crtfastmath.o  include-fixed  libgcc.a   libstdc++.a         libstdc++.la  libsupc++.la
crtend.o    include        install-tools  libgcov.a  libstdc++.a-gdb.py  libsupc++.a   plugin

Now you have libsupc++, libgcc.a and include. These are what you need!.
Place these files to your OS's library path and include path, compile and link your application with -lgcc -lsupc++.
That's all.