Compiling OBC

From Spivey's Corner

Jump to: navigation, search

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

  1. 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
  2. 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].
  3. Also add GtkSourceView2 from http://ftp.gnome.org/pub/gnome/binaries/win32/gtksourceview and libxml2 from ftp://xmlsoft.org/libxml2/win32.
  4. Install Inno Setup from http://www.innosetup.com/isdl.php.
  5. Install the MinGW version of OCaml from http://caml.inria.fr/ocaml/release.en.html
  6. Install flexdll from http://alain.frisch.fr/flexdll.html (apparently already present in OCaml from release 3.11).
  7. Check out the sources with subversion, or unpack the source tarball. It helps to use the svn command in a Command Prompt window first, as there it's possible to paste in the password.
  8. Configure and build using winport/winconfig
  9. Cd to winport then make and make 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 crypt and libssp0.
  • Cygwin allows multiple versions of gcc to coexist by making /usr/bin/gcc.exe a symlink to /etc/alternatives/gcc, and making another symlink from there to /usr/bin/gcc-3.exe. The flexdll tool 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.exe and copy /usr/bin/gcc-3.exe in 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).

  1. Install xcode from the OS/X DVD.
    • Remember to include the 10.5 SDK.
  2. Install OCaml from source.
    • Set the compiler for 32 bits with configure CC='gcc -arch i386'.
  3. 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 jhbuild sets the DYLD_LIBRARY_PATH environment variable appropriately.
  4. Use "jhbuild shell" to get an environment for building OBC.
    • Use sh macport/macconfig to configure with the correct compiler options.
    • Then make to build everything.
  5. Finish with sudo make install to install OBC and a private copy of the necessary GTK libraries under /usr/local.
  6. Or (cd macport; make package) to make a Mac OS/X installer.
Navigation
Toolbox