8. Build Mingw gcc-4.6.1 - WebKit porting to Mona OS

Where are we?

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


% mkdir ~/mingw
% cd src
% wget http://ftp.gnu.org/gnu/binutils/binutils-2.21.1.tar.gz
% tar vxf binutils-2.21.1.tar.gz
% cd binutils-2.21.1
% ./configure --prefix=~ --target=i586-mingw32msvc
% make && make check && make install

Mingw headers and libraries

cd ~/mingw
% tar vxf ~/Download/w32api-3.17-2-mingw32-dev.tar.lzm
% tar vxf ~/Download/mingwrt-3.18-mingw32-dev.tar.gz


N.B. I you build gcc serveral times for option tuning. You should "clean build", which means rm -rf gcc-4.6.1 and rm -rf ~/i586-mingw32msvc.

% sudo apt-get install libmpfr-dev
% sudo apt-get install libmpc-dev
% tar vxf ~/Download/gcc-4.6.1.tar.bz2
% mkdir build-gcc
% cd gcc-4.6.1/
$ PATH=/home/taro/bin/:$PATH ../gcc-4.6.1/configure --prefix=/home/taro --target=i586-mingw32msvc --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads  --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath --disable-target-libiberty --disable-target-zlib --enable-languages=c,c++ --without-ppl --without-cloog  --with-headers=/home/taro/mingw/include --with-libs=/home/taro/mingw/lib --with-as=/home/taro/bin/i586-mingw32msvc-as --with-ld=/home/taro/bin/i586-mingw32msvc-ld  --enable-sjlj-exceptions --enable-version-specific-runtime-libs
% make && make install

Build Mona with the compiler

some link erros

  • libnurbs/interface/bezierEval.o:bezierEval.cc:(.text+0x1a9): undefined reference to `__chkstk_ms'
    • Added CFLAGS: -mno-stack-arg-probe -fno-stack-check -fno-stack-protector
  • ertr000001.o:(.rdata+0x0): undefined reference to `_pei386_runtime_relocator'
    • Added LDFLAGS: --disable-runtime-pseudo-reloc

Run Mona

Mona was hung up at two point. One may be miss optimization on compilation. The other is buffer overflow bug.