waterson: soar on os/x
home | <

overview

This document describes how to modify the stock Soar-8.4 distribution so that it will build and compile under Mac OS/X. Depending on whether you're building on 10.1 or 10.2, the steps vary slightly.

instructions

  1. To get this to compile on OSX, I had to apply this patch (which probably would be pretty helpful for compiling with newer versions of Tcl, anyway), and then re-run autoconf in the kernel directory to rebuild configure.

    The patch does the following:

    • Fixes the kernel's configure so that it doesn't stomp the CFLAGS variable. This probably isn't the best fix: instead we ought to do some platform sniffing (a la Tcl's m4 file) to determine that -fno-common is necessary for OS/X.
    • Removes the code that tries to source soar.tcl out of the native interpreter into pkgIndex.tcl: for some reason, I crash when trying to do a nested interpretation. Maybe Tcl isn't re-entrant, or maybe we're re-entering it in a way it doesn't like.
  2. I built the kernel with:

    (10.1)
    CFLAGS="-fno-common -O2 -w" ./configure
    make
    
    (10.2)
    CFLAGS="-fno-common -O2 -w" ./configure --with-tcl-lib-dir=/System/Library/Tcl/8.3
    make

    OS/X needs the -fno-common to link a dylib; as noted above, this ought to be sniffed and built into the configure file itself. OS/X 10.2 requires you to specify the --with-tcl-lib-dir so it can find tclConfig.sh

  3. I built the tcl-interface with

    (10.1)
    CFLAGS="-fno-common -O2 -w" ./configure --disable-static-soartk --disable-static-soar
    make
    
    (10.2)
    CFLAGS="-fno-common -O2 -w" ./configure --disable-static-soartk --disable-static-soar \
    --with-tcl-lib-dir=/System/Library/Tcl/8.3
    make

    I don't have Tk installed yet (it's not even officially ported!), so there was no tkConfig. (And I don't need a static version, anyway: I don't know why this is the default.) Again, 10.2 requires --with-tcl-lib-dir.

    Note! I haven't yet munged the above patch to deal with properly linking on 10.2, so the link will fail. When the build dies, simply repeat the last command that was issued, and append -ltcl: this should get the link to work.

  4. Copy libsoar8.4.dylib to the library directory (or, symlink to it from the library directory).

  5. To run:

    TCLLIBPATH=[path to soar library] SOAR_LIBRARY=[path to soar library] tclsh8.4

    In other words, make sure that your SOAR_LIBRARY is the path to your Soar installation's library directory (i.e., the directory containing libsoar8.4.dylib and soar.tcl), and make sure that your TCLLIBPATH contains as one if its elements the SOAR_LIBRARY.