Building HippoDraw 1.51

OK, I've loved HippoDraw on NeXTSTEP as a wonderful plotting package. It was Open Source and that's great. I believe that CERN did a lot of work on it - they still may, I'm not positive. Anyway, I wanted something for my Powerbook and so I decided to go through the troubles of building HippoDraw for Mac OS X.

  1. First, get the sources for Boost-Jam. This is a build tool that the Boost folks have put together. Interesting aside on this point - the Boost folks are putting together what they believe to be the missing object library for C++. Interesting that they went the library route when the STL group (obviously) took the templates route. But having read the docs for HippoDraw, it's clear that I'm going to need to get the Boost.Python library going, so I'm going to need Boost.

    So... go to the Boost web site and pick up the sources for boost-jam as well as Boost itself. There are pre- built binaries for Linux, etc. but nothing for Mac OS X. I got boost-jam 3.1.9 and Boost 1.31.

  2. Now we need to build boost-jam. After unpacking it into a directory, build it with:

    % ./build.sh darwin
    

    and then put the results of the build into /usr/local/bin with:

    % sudo cp bin.macosxppc/* /usr/local/bin/
    
  3. Next, unpack and build Boost for Panther with Python 2.3:

    % cd ~/Developer/boost_1_31_0/
    % setenv PYTHON_ROOT /System/Library/Frameworks/Python.framework/Versions/2.3
    % setenv PYTHON_VERSION 2.3
    % sudo bjam "-sTOOLS=darwin" install
    

    and then to clean up the installation by:

    % cd /usr/local/include/boost-1_31
    % sudo mv boost ..
    % cd ..
    % sudo rm -rf boost-1_31
    % cd /usr/local/lib
    % ln -s libboost_python-1_31.dylib libboost_python.dylib
    
  4. Now build Qt/Mac. First, download the source to /usr/local and then rename the download version (3.3.1 in my case) to /usr/local/qt - or link it if you want to keep the version information. Then:

    % configure -thread
    % cd /usr/lib
    % sudo ln -sf /usr/local/qt/lib/libqt-mt.3.3.1.dylib libqt-mt.dylib
    % sudo ln -sf /usr/local/qt/lib/libgui.1.0.0.dylib libgui.dylib
    

    This is really all in the Qt/Mac docs.

  5. On Panther, in the Python includes, I've found a little problem that I haven't really dug into as I'm not a major Python fan. In the Python include directory: $PYTHON_ROOT/include/python2.3 there's a file, object.h. It seems that there's a compile time parsing problem with line 343:

    PyObject *name, *slots;
    

    that needs to be changed to:

    PyObject *name, *user_slots;
    

    in order for things to compile correctly. I've tried to find references to 'slots' but to no avail. I'm not worried about it as I'm not sure the impact, but it's something to consider - and certainly back up object.h if you make the change.

  6. On Panther, I've found that isnan(x) is not properly but it's easy enough to correct. In HippoDraw 1.5.1 it turns out that you need to add the lines:

    #ifdef __MACH__
    #ifndef isnan
    #define  isnan(x) ((sizeof(x) == sizeof(double)) ? __isnand(x) : 
                      (sizeof(x) == sizeof(float)) ? __isnanf(x) : __isnan(x))
    #endif
    #endif
    

    at the top of minimizers/BFGSFitter.h to get it to compile. Also, the libtool needs to have a modification. At line 2889 the original libtool reads:

    # Add a -L argument.
    newdeplibs="$newdeplibs $a_deplib" ;;
    

    which needs to be changed to:

    # Add *only* a -L argument
    case $a_deplib in
      -L*) newdeplibs="$newdeplibs $a_deplib" ;;
    esac
    

    Also in libtool you need to add the lines:

    -framework | Carbon | QuickTime | System | OpenGL | AGL)
      deplibs="$deplib $deplibs"
      continue
      ;;
    

    around line 1785 right before the line:

    %DEPLIBS%)
    

    After that, it's a standard build with a few arguments:

    % configure --with-Qt-dir=/usr/local/qt --with-Qt-lib=qt-mt 
                --with-boost-includes=/usr/local/include/boost 
                --with-boost-lib=/usr/local/lib 
                --with-python-include=$PYTHON_ROOT/include/python2.3
    % make