Skip to content

Cross Compiling FXRuby for MinGW on Linux

lylejohnson edited this page Sep 13, 2010 · 5 revisions

This page describes how to set up a cross-compilation environment on Ubuntu Linux 9.04, for building FOX and FXRuby that target MinGW.

Start by installing the cross-compilation tools:

sudo apt-get install mingw32

Next, download and install zlib:

tar xzf zlib-1.0.4.tar.gz
cd zlib-1.0.4
make CC=/usr/bin/i586-mingw32msvc-cc
# get an error when it tries to build libz.a, ignore
rm libz.a
/usr/bin/i586-mingw32-msvc-ar rc libz.a *.o
make install prefix=$HOME/mingw

Next, download and install bzip2:

tar xzf bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
# modify bzip2.c to avoid compile error on executable (optional)
make CC=/usr/bin/i586-mingw32msvc-cc AR=/usr/bin/i586-mingw32msvc-ar RANLIB=/usr/bin/i586-mingw32msvc-ranlib
make install PREFIX=$HOME/mingw

Next, download and install libpng:

tar xzf libpng-1.2.40.tar.gz
cd libpng-1.2.40
CFLAGS="-I$HOME/mingw/include" LDFLAGS="-L$HOME/mingw/lib" ./configure --prefix=$HOME/mingw --disable-shared --host=i586-mingw32msvc
make
make install

Next, download and install libjpeg:

tar xzf jpegsrc.v7.tar.gz
cd jpeg-7
./configure --prefix=$HOME/mingw --disable-shared --host=i586-mingw32msvc
make
make install

Next, download and install libtiff:

tar xzf tiff-3.8.2.tar.gz
cd tiff-3.8.2
CFLAGS="-I$HOME/mingw/include" LDFLAGS="-L$HOME/mingw/lib" ./configure --prefix=$HOME/mingw --disable-shared --host=i586-mingw32msvc
make
make install

Next, download and install FOX:

tar xzf fox-1.6.36.tar.gz
cd fox-1.6.36
CFLAGS="-I$HOME/mingw/include" CXXFLAGS="-I$HOME/mingw/include" LDFLAGS="-L$HOME/mingw/lib" ./configure --prefix=$HOME/mingw --disable-shared --host=i586-mingw32msvc
make
# build stops near the end when it tries to run reswrap

Next, download and install FXScintilla:

tar xzf fxscintilla-1.71.tar.gz
cd fxscintilla-1.71
CPPFLAGS="-I$HOME/src/mingw/fox-1.6.36/include" LDFLAGS="-L$HOME/src/mingw/fox-1.6.36/src/.libs" ./configure --prefix=$HOME/mingw --disable-shared --host=i586-mingw32msvc
make
make install

Now, build FXRuby:

rake cross compile CXX=/usr/bin/i586-mingw32msvc-g++

Clone this wiki locally