Version 1 of Tile and BLT together on MacOS X

Updated 2006-09-10 13:26:56 by TR

TR I have an application using BLT that runs on Linux, Windows, and MacOS X (the X11 version of Tcl, since BLT is not ported to Aqua). That worked great ... until the time, when I decided to use Tile, because it was so beautifula dn had some widgets I wanted to use. Then the problem came for MacOS X ...

Currently (Sept. 2006), only the ActiveTcl distribution comes with Tile. But it comes without BLT. The TclTkAquaBI comes with BLTlite only and without Tile. The preinstalled Tcl/Tk on MacOS X Tiger comes without both. So only the fink and DarwinPorts projects have Tcl/Tk and BLT that work together.

I never succeeded in compiling BLT for the Mac on any of these distributions on my own (i.e. from source). There are evidently some patches needed. So the only way to go, at least for me, was to get the distribution that supported BLT (without the need to compile it manually) and allowed Tile to be used additionally.

In order to use Tile, you need a fairly recent Tk, something newer that 8.4.6 or so. The fink project has stable versions of 8.4.1 so this would not work and I didn't want to try and get unstable versions. Further, fink's BLT package seems to have no maintainer. I therefore decided to use DarwinPorts (now called MacPorts) which comes with a very recent 8.4.12 version of Tcl/Tk. And it has a BLT package. An additional "advantage" of using MacPorts was that the complete MacPorts system is built using Tcl so there is hope that the Tcl package will always be a good one and actively maintained.

The obvious step was to just compile Tile (I used version 0.7.6 here) for the Mac and then be finished. But this turned out to be not so straightforward. But now, after some months of trying around and some hints from the Tcl chatroom (Thanks a lot, you guys!!), it all boiled down to the following advice:

Never mix distributions and/or versions

Compiling Tile requires a private Tk header file (tkInt.h). This is not included in MacPorts' distribution. It will not be very helpful to install ActiveTcl on the Mac and use it's headers, because you cannot really specify the location for private header files on the command line of the configure script. The solution was to get the source distributions of Tcl and Tk off sourceforge (exactly same version as the installed one by MacPorts, i.e. 8.4.12) and do a standard configure on both of them:

  ./configure

This will produce the two files tclConfig.sh and tkConfig.sh that are required to compile Tile. Be aware that you can just go into the unix directory of the Tcl and Tk sources and call configure there. There is no configure script in the macosx directory but only a Makefile. This is just a wrapper around the unix configure (says the provided REAMDE).

There is one more thing. In order to get a good result from configure, you should also fetch the XFree86 package that is shipped with MacPorts, because Tk's configure will look for X11.

Don't expect the Tile configure script to find these Tcl sources on it's own. Just doing

 ./configure

in the 'generic' folder of the Tile sources (using Joe's build system) will result in an odd folder named /Users/andreask and many subfolders where Tile will be installed into and it is likely that you can't build Tile at all. You need to specify exactly where you have the required files, and where you want to have Tile installed into, else you will not get what you want. Especially, do not rely on what './configure --help' is telling you about the locations of --prefix and --exec-prefix but specify both manually. You will need these options:

  • --prefix
  • --exec-prefix
        * --with-tcl
        * --with-tk

Here is what I did in my configuration:

 ./configure --prefix=/Users/Torsten/Tcl/packages/tile 
 --exec-prefix=/Users/Torsten/Tcl/packages/tile
 --with-tcl=/Users/Torsten/Tcl/distrib/tcl8.4.12/unix/
 --with-tk=/Users/Torsten/Tcl/distrib/tk8.4.12/unix/

After 'make' and 'sudo make install' I had a working Tile for MacPorts Tk package that could be used by adding the tile folder to 'auto_path':

 lappend auto_path /Users/Torsten/Tcl/packages/tile/lib

Note, that the 'aqua' theme is not available here, perhaps because MacPorts' Tk is X11 only?

What is on my wish list?

It would have been simple if BLT shipped with ActiveTcl. Since the MacPort people can provide BLT and obviously successfully patched the BLT sources to compile happily, I would image that it must be simple enough to adapt the stuff to ActiveTcl's requirements. Here is the pointer:

 http://cvs.opendarwin.org//cgi-bin/cvsweb.cgi/proj/darwinports/dports/x11/blt/


Category Operating System - Category Mac - Category BLT