I just got a fresh install on my laptop of Ubuntu 10.10 and I had to set some things up after restoring my backup files (long story). So I thought it’s a good chance to make some notes of the process.
I wanted to setup again my development enviroment for cross-compiling for w32 some C++ projects I like to develop. First of all I install MinGW on my Ubuntu installation.
sudo apt-get install mingw32
Happy to notice that there is a
mingw-w64 package on the repositories, but I’ll have to try this another time.
It’s being a long time I’m trying to figure out a file structure on my home directory to keep the source code and cross-compiled libs in a seperate place for each platform. I decided to mimic the POSIX style. So I create a usr directory on top of my home directory and use local subdirectory for my current platform builds and w32 for the w32 platform. I was never sure what
/usr/local meant on POSIX systems but this seems to work for me now 🙂
~/usr/local/src ~/usr/local/include ~/usr/local/lib ~/usr/local/bin ~/usr/w32/src ~/usr/w32/include ~/usr/w32/lib ~/usr/w32/bin
And now the first cross compilation must take place. I need to compile fltk2 with mingw32 for w32 platform. There is a nice README.mingw32_cross to help you with the process but it fails on some point. So I had to use an ugly work around to go on.
First of all following the README.mingw32_cross I ran a
./configure with the following arguments:
$ ./configure --build=i586-mingw32msvc --host=i586-mingw32msvc --target=i586-mingw32msvc --prefix=$HOME/usr/w32
And now for the ugly work around. I had to edit
makeinclude with the following:
CFLAGS = $(OPTIM) -I/usr/i586-mingw32msvc/include CXXFLAGS = $(OPTIM) -I/usr/include/freetype2 -I/usr/i586-mingw32msvc/include -Wno-non-virtual-dtor
# flags for C++ compiler: CFLAGS=" -I/usr/i586-mingw32msvc/include" CXXFLAGS="-I/usr/include/freetype2 -I/usr/i586-mingw32msvc/include -Wno-non-virtual-dtor" LDFLAGS=" -L/usr/lib " LDLIBS=" -L/usr/lib -lXi -lXinerama -lXext -lsupc++
I’m almost sure there is a better way to do this, but I’m not really familiar with
configure tools. If someone has a neater solution please leave a comment.
And now run
The build fails but on fluid2 but it’s ok for me as long as the library gets compiled. Running
make install will put my w32 cross compile fltk2 library in
Download the Amalgamation sqlite3 tarball extract it in
$HOME/usr/w32/src, do some configuring, build and install:
$./configure --build="i586-mingw32msvc" --host="i586-mingw32msvc" --target="i586-mingw32msvc" --prefix="$HOME/usr/w32" $make $make install
And just worked.