Update on cross building mxe-octave

It’s time for another update on my GSoC project (yes I know I should blog more often). I was inactive for a couple of days due to lack of internet access. When I came back, I had a new laptop with Intel Core i5 processor which is much faster than the old Intel Atom powered laptop I owned. So now I am able to produce faster builds, not to forget that now I can compile parallely using multiple cores (I can do make octave -j4).

I did a fresh install of OpenSUSE on my laptop. For some time I was having trouble installing Mecurial because auto-refreshing of the configured repositories was failing. Figured out that I was hitting a faulty mirror. After fixing that, I went ahead to cross build the latest version of mxe-octave. As of now, there have been many new packages added to mxe-octave like FFTW, PCRE, freetype, expat, fontconfig, GLPK, libpng, qrupdate, HDF5, QHull, libxml2, jasper, TIFF, lcms, GraphicsMagick, ITSOL, and OpenBLAS. I have successfully produced another cross build which can be downloaded here.

However, I could not add the package ITSOL in my build. Apparently this package is not built automatically, and I had to do make itsol to build it during which I was thrown this error:

/home/ani/mxe-octave/usr/bin/i686-pc-mingw32-gcc -c -O2  -I./INC -DLINUX -o OBJ/systimer.o -c SRC/systimer.c
SRC/systimer.c:28:23: fatal error: sys/times.h: No such file or directory
compilation terminated.
make[2]: *** [OBJ/systimer.o] Error 1

I chose to ignore the package and continued without ITSOL. I will work on its fix later.

I was interrupted many times while building the packages gmp, Lapack, BLAS (reference BLAS) and FFTW. The problem with gmp was pretty lame since I had passed both the options –enable-static and –enable-shared in ./configure because of which I got an error “cannot build both static and DLL, since gmp.h is different for each”. The error disappeared when I did ./configure –enable-shared –disable-static.
For the package FFTW, I bypassed the error by forcing the local implementation of malloc() during configure by modifying the build specs in the src/fftw.mk file. The problem was solved when I added –with-our-malloc as options in all the occurrences of ./configure. See this discussion regarding the error.
The packages lapack and blas failed to build due to missing FORTRAN Compiler. See the issue and my solution in this discussion. It was nice of Michael to explain me the real reason behind the error.

The following is an extract from the log of octave. It tells us about the features enabled in my current build.

Build Octave GUI:                   yes
JIT compiler for loops:             no
Build Java interface:               no
Do internal array bounds checking:  no
Use octave_allocator:               no
Build static libraries:             no
Build shared libraries:             yes
Dynamic Linking:                    yes (LoadLibrary)
Include support for GNU readline:   yes
64-bit array dims and indexing:     no

Though my build has GUI enabled in it, yet I haven’t been able to launch Octave GUI in Windows 8 environment. See this reportage in the mailing list about the issue.
I am also unable to get JIT support despite using the option –enable-jit during ./configure and successfully building LLVM. Experimental Java support in MXE is also yet to added.

During this week, I have also started with a native build of mxe-octave in MinGW on Windows 8. I am presently unable to proceed further because libpng fails to build at some point. I will investigate more into this issue and ask in the mailing list, along with the issues I faced with JIT support, and ITSOL package.

Since I already have a working version of Octave, I will start my work on building the installer for Octave using NSIS. I will dedicate a blog post summing up the ideas of the installer given by my mentor.

That’s all for now.
Cheers!

Building mxe-octave

I have been working for a while on cross-compiling Octave for Windows platform using M Cross Environment (MXE) with MinGW, and after hours of compilation I have a functional version of Octave built for Windows, though not a complete one. You can download the zipped package here.

The package contains pre-compiled binaries of almost all the dependencies needed to run Octave. If you want to install Octave from this package, all you need to do is extract it, and then execute the file /bin/octave.exe from a MinGW/MSys or Cygwin shell. Executing the file directly by double clicking on it also starts Octave. You can write a simple hello world program to test if the package is working properly.

> printf("Hello World\n")

prints Hello World
After running make octave and ./mk-dist, I have a total of 102 items in the installed-packages directory. For the sake of a comprehensive report, following is the list of packages.

hdf5 msys-sed of-general of-control libiconv
native-gcc gnutls tiff pstoedit build-gperf
libtool msys-gzip freetds openssl gnuplot
gcc-mpfr msys-diffutils uuid msys-grep arpack
libpng libxml2 suitesparse npp glpk
build-bison libidn freetype msys-make nettle
gmsys-findutils texinfo libssh2 jasper binutils
of-communications pthreads fltk termcap postgresql
lapack gcc-gmp fontconfig msys-tar qscintilla
xz of-io gettext build-texinfo build-autoconf
curl jpeg w32api native-binutils qhull
qhull sqlite expat libodbc++ qt
build-pkg-config of-optim readline of-miscellaneous pcre
build-cmake of-struct gcc msys-bash blas
build-libtool of-specfun libgcrypt zlib build-automake
msys-gawk gmp octave msys-libmagic lcmsl
build-flex msys-less fftw of-image dbus
libgpg_error bzip2 gcc-mpc of-statistics msys-msys-core
llvm check-requirements msys-file graphicsmagick msys-termcap
msys-regex of-signal libmng msys-libiconv qrupdate
msys-libintl

I had faced a few problems while building mxe-octave, because of which it took me a lot of time to complete the cross-compilation. One of the errors thrown at me was while building pkg-config-0.28. Strangely, I got the error even though I had the latest version of libtool installed.

/home/ani/mxe-octave/tmp-build-pkg-config/pkg-config-0.28/configure: line 2600: syntax error near unexpected token `2.2'
/home/ani/mxe-octave/tmp-build-pkg-config/pkg-config-0.28/configure: line 2600: `LT_PREREQ(2.2)'
make[1]: *** [build-only-build-pkg-config] Error 2

I fixed the above error by omitting the call to the command autoreconf in the file mxe-octave/src/build-pkg-config.mk. I did it by appending -h to autoreconf. Removing the command entirely should also do the same thing. If anyone is facing similar problems while building mxe-octave, then he/she can try the above workaround.

During a recent update, John. W. Eaton set “make octave” as the new and default target for all packages. I am presuming that “make octave” downloads and builds only the packages specific to Octave, while “make” builds many others which are not needed (Eg. Glib, which I was trying to build unnecessarily). So I figured out that it is wise to use “make octave”.

I will now probably start working on adding a few missing dependencies to mxe-octave.

Hello World!

I am very excited to let you know that I have been selected as a Google Summer of Code student to work for GNU Octave. My sincere thanks to the Octave community, and my teacher Mukesh Tiwari for encouraging me. I will use this blog to post updates about my GSoC work at least once a week (or more often if I get something to update). I have provided the details of my project below.

Project Title: Improve Binary Packaging
URL: http://www.google-melange.com/gsoc/project/google/gsoc2013/ani07nov/23001

I have decided to work on the mxe-octave repository by John W. Eaton in an attempt to improve his work. Right now I am trying to fix some problems I am facing while building his fork of MXE. When I run ‘make’ some packages fail with a build error. I switched from Ubuntu to OpenSUSE and the errors have minimized (no idea how), but I am yet to get a complete version of Octave built for Windows. The Community Bonding Period of GSoC will be over by June 16. My aim will be to solve these issues before the coding period starts. I will also chalk out a more revised time-line and goals for the mid-term evaluation once I am all set.