Compiling OBC
From Spivey's Corner
This page contains instructions for compiling OBC on various unfriendly platforms.
Contents |
Older versions of Linux
The machines in our software lab used to have some ancient version of Red Hat installed, and it wasn't possible for our support staff to update them during the year, for obvious reasons. There's a better version installed now, but for posterity's sake, here are a few hints about coping with older and more hostile environments ...
A recent version of GTKSourceView 2.0 is needed, and that implies a recent version of GTK+. The following packages needed to be built and installed in ~/local:
cairo-1.8.6 gtksourceview-2.4.1 glib-2.18.3 intltool-0.40.5 pango-1.20.5 gtk+-2.14.6 pixman-0.13.2
Then I installed ocaml-3.11 and lablgtk-2.12.0.
The script for running the debugger needed this assignment to allow GTK to find certain files:
export XDG_DATA_DIRS=/ecslab/mike/local/share:/usr/local/share:/usr/share
Windows
- Install Cygwin by running http://www.cygwin.com/setup.exe.
- Choose the following packages, or come back and add them later:
- subversion, autoconf-2.5, gcc, gcc-mingw, tcltk, make, pkg-config, diffutils
- You'll also want to choose the following for convenience:
- emacs
- Choose the following packages, or come back and add them later:
- Get GTK from http://www.gtk.org/download-windows.html, using one of the packaged versions [?obsolete: and adding GNU iconv (not the "small footprint" version) from the same page].
- Also add GtkSourceView2 from http://ftp.gnome.org/pub/gnome/binaries/win32/gtksourceview and libxml2 from ftp://xmlsoft.org/libxml2/win32.
- Install Inno Setup from http://www.innosetup.com/isdl.php.
- Install the MinGW version of OCaml from http://caml.inria.fr/ocaml/release.en.html
- Install flexdll from http://alain.frisch.fr/flexdll.html (apparently already present in OCaml from release 3.11).
- Check out the sources with subversion, or unpack the source tarball. It helps to use the
svncommand in a Command Prompt window first, as there it's possible to paste in the password. - Configure and build using winport/winconfig
- Cd to winport then
makeandmake package
But ...
- There are dependency problems with the current installer for Cygwin 1.7. The symptom is that perl fails with the cryptic message
/bin/perl.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
- and that matters because seemingly perl is used by autoconf these days. The solution is to install manually the missing packages
cryptandlibssp0.
- Cygwin allows multiple versions of gcc to coexist by making
/usr/bin/gcc.exea symlink to/etc/alternatives/gcc, and making another symlink from there to/usr/bin/gcc-3.exe. Theflexdlltool that's used to link OCaml programs won't tolerate this, and gives the helpful message
Access is denied. ** Fatal error: hd File "_none_", line 1, characters 0-1: Error: Error while building custom runtime system
- So you need to remove the symlink
/usr/bin/gcc.exeand copy/usr/bin/gcc-3.exein its place.
Mac OS/X
Cross-building for Mac OS/X 10.5 (Leopard) on a machine running Mac OS/X 10.6 (Snow Leopard).
- Install xcode from the OS/X DVD.
- Remember to include the 10.5 SDK.
- Install OCaml from source.
- Set the compiler for 32 bits with
configure CC='gcc -arch i386'.
- Set the compiler for 32 bits with
- Install GTK for OS/X via JHBuild.
- Set up to use the 10.5 toolkit and generate i386 code by
cp macport/jhbuild-custom ~/.jhbuild-custom. (Some things don't work in 64 bits yet. - Then jhbuild bootstrap and jhbuild. The results are installed in ~/gtk/inst.
- Fix the pathnames that are built into the libraries by running the shell script macport/rename-libs. It will still be possible to use the uninstalled libraries for testing, because
jhbuildsets theDYLD_LIBRARY_PATHenvironment variable appropriately.
- Set up to use the 10.5 toolkit and generate i386 code by
- Use "jhbuild shell" to get an environment for building OBC.
- Use
sh macport/macconfigto configure with the correct compiler options. - Then
maketo build everything.
- Use
- Finish with
sudo make installto install OBC and a private copy of the necessary GTK libraries under/usr/local. - Or
(cd macport; make package)to make a Mac OS/X installer.