[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lessons from cross-compiling Octave: Linux -> Cygwin

From: Carlos Puig
Subject: Lessons from cross-compiling Octave: Linux -> Cygwin
Date: Tue, 14 Nov 2000 00:27:09 -0800


This weekend I successfully cross-compiled Octave (both version 2.0.16
and version 2.1.31) on a Red Hat 6.2 host with a (Window 98) Cygwin
target.   The binary distributions worked well on the Windows 98

I'd like to pass along the lessons I learned on the way.   Here are the
main ones:

(1) The stock GNU compiler (GNU gcc-2.95.2) chokes on so-called
anonymous struct/union constructs in the Cygwin headers.  Instead of
using the GNU release, one must build the cross-compiler from sources
provided by the Cygnus sourceware project (currently gcc-2.95.2-5).   I
ended up with two gcc builds: started with a native linux-gnu version
and then used the native version to build the cross-compiler.

In addition, one of the gcc headers (system.h) needed a simple patch in
the declaration of strsignal()  --  change the prototype to const char *
strsignal (int * signo)  --  to avoid a conflict with one of the Cygwin
headers.   I have a patch file, if anyone is interested.

(2) For Octave 2.0.16, the target must be set to ix86-pc-cygwin32, while
for Octave 2.1.31 and for gcc-2.95.2-5, the target must be set to

(3) Cross compilation of Octave 2.0.16 was generally uneventful.   One
minor hitch: The binary-dist make complains about a missing
install-octave file, which I found under the source tree and copied
manually to my build tree.

(4) On the other hand, the Octave 2.1.31 make files required a few
modifications for cross-compilation.   Three helper programs (gethelp,
gendoc, and munge-texi) are built along the way during the make.   These
three programs must be built using the *native* Linux compiler, while
everything else must be built using the cross-compiler.  Thus the PATH
environment variable must be set differently for the three helper
programs.   I have a patch file, if anyone is interested.

In addition, the Octave 2.1.31 make invokes program munge-texi before it
has built src/DOCSTRINGS, which is used by munge-texi -- this results in
a fatal make error.   I did not try to figure out how to fix the make in
this case, but instead I ran make DOCSTRINGS manually in src, and then
restarted the main octave make, which finished ok the second time.

(5) The final hurdle was that the Octave info files (both 2.0.16 and
2.1.31) did not work with info under the latest Cygwin release.  Neither
running info from the bash prompt, nor using help -i inside Octave
failed to retrieve help for most queries.  Generally, info complained
about not finding the appropriate files.

These info files were built with makeinfo 4.0 on the Red Hat 6.2 host.
These info files worked fine with makeinfo 4.0 under DJGPP on the
Windows machine, but they failed with makeinfo 1.68 (from texinfo 3.12)
under Cygwin.

I tried building GNU texinfo 4.0 under Cygwin, but the make failed in
the doc subdirectory.  (It complains about Invalid argument with a
perfectly valid input file).   The fix was to add -DWIN32 to the DEFS
make variable in file makeinfo/Makefile and re-make the makeinfo
program.  It seems that defining WIN32 fixes a known problem in files.c.
With the fixed makeinfo and info 4.0 on the Cygwin system, Octave help
worked fine.


My reason for going with cross-compilation was that a native Cygwin
build took a very long time to finish -- effectively locking up my
Windows machine useless while the build was running -- but was much
better behaved under Linux.   The Cygwin setup has a 766 MHz Pentium
III, while the Linux setup uses a 233 MHz Pentium MMX, but nevertheless
a Cygwin native build is many times slower.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]