Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Aqua (non-X) labltk on Mac OS 10
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Trevor Jim <trevor@r...>
Subject: [Caml-list] Aqua (non-X) labltk on Mac OS 10
I managed to get labltk working in Mac OS 10 with the Aqua (non-X)
version of Tk.  It's a bit clunky but maybe someone who knows more
about these things can clean it up.

Here's how it goes:

You need Mac OS 10.x with the Developer's CD installed (I'm running

Obtain the tcl-8.4.1 and tk-8.4.1 source from  (There now seems to be a binary
distribution, but that wasn't available when I started this.  Someone
else can give that a try.)

Follow these instructions to compile and install Tcl/Tk
(summarized from

   tar zxvf tcl8.4.1-src.tar.gz
   tar zxvf tk8.4.1-src.tar.gz
   mv tcl8.4.1 tcl
   mv tk8.4.1 tk
   cd tcl/macosx
   make >& make.log
   sudo make install
   cd ../../tk/macosx
   make >& make.log
   sudo make install

(NOTE: the mv's are in fact necessary.)

Obtain the ocaml-3.06 source and apply Jacques' patch so that it will
compile with tcl/tk 8.4.  (See

In the ocaml source directory do

   ./configure -tkdefs "-I/Library/Frameworks/Tcl.framework/Headers 
-I/Library/Frameworks/Tk.framework/Headers" -tk-no-x11 -tklibs 
"-F/Library/Frameworks/Tcl.framework -framework Tcl 
-F/Library/Frameworks/Tk.framework -framework Tk"

   make world
   make opt
   sudo make install
   make clean

Now you should be able to compile programs using labltk; but it takes
a bit more to get your program to run properly.  For example, in the
ocaml source directory, do

   cd otherlibs/labltk/examples_labltk
   ocamlc -o calc -I +labltk labltk.cma

You now have a compiled calc program that will bring up a window, but
if you do


you will get an error message

   SetFrontProcess failed,-606

when you try to use the calculator.

To fix this you have to make an "application bundle", this is how
applications are packaged up on Mac OS 10.  So do

   mv calc

Now using your favorite editor create a file with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">

(For a program named foo, you would of course substitute foo for calc
in the Info.plist file.)

That's it.  You can run the application from a terminal by doing


Or, you can double-click from the Finder.  Note, the .app
extension will be hidden by the Finder.  Neither of these methods
allows command-line arguments to be passed to the program; I don't
know how to do that.

The labltk toplevel doesn't quite work -- the SetFrontProcess failure
comes up.  Maybe someone else can fix that.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: