2011-05-11
Building Mozart/Oz on Windows
The Mozart Programming System is an implementation of the Oz programming language. It's the language used in the book Concepts, Techniques, and Models of Computer Programming by Peter Van Roy and Seif Haridi. From the Mozart website:
Mozart is based on the Oz language, which supports declarative programming, object-oriented programming, constraint programming, and concurrency as part of a coherent whole. For distribution, Mozart provides a true network transparent implementation with support for network awareness, openness, and fault tolerance. Mozart supports multi-core programming with its network transparent distribution and is an ideal platform for both general-purpose distributed applications as well as for hard problems requiring sophisticated optimization and inferencing abilities.
The last release of Mozart was a couple of years ago and the steps to build on Windows no longer seem to work. It required Cygwin to build but used the MingW compiler to get a native Windows build.
Mozart/Oz has recently seen a bit of a life with activity in the mailing lists and a move to github for source control and issue tracking. I was working on a project that needed Windows and Linux support so thought I'd have a try at converting Mozart to compile using MingW on Windows.
I've got a basic build working and have patches that I hope will eventually be merged. In the meantime I thought I'd post about how to build using MingW with my patches. The following steps will build Mozart, the standard library, Emacs (used as the IDE) and Tcl/Tk (for GUI).
- Download and install mingw-get-inst. Install the 'MSYS Basic System' and the 'C++ Compiler'.
From the 'MingW Shell', run the following commands to install the required support packages:
$ mingw-get install mingw32-libgmp $ mingw-get install mingw32-gmp $ mingw-get install mingw32-libz $ mingw-get install msys-libgdbm $ mingw-get install msys-libregex $ mingw-get install mingw32-autoconf2.1 $ mingw-get install mingw32-autoconf $ mingw-get install msys-flex $ mingw-get install msys-bison $ mingw-get install mingw32-gcc-g++ $ mingw-get install msys-wget
Download and install the msysgit package. I installed it in
C:/git
. It's best to install it in a directory that doesn't have spaces in the name.Make a directory to store the resulting 'Mozart/Oz' binaries. I used
/p
to keep my command lines short but you could also use/mingw
to install alongside the existing MingW programs:$ mkdir /p
Download and build Tcl/Tk 8.5 from source, configured to install in the directory above:
$ wget http://prdownloads.sourceforge.net/tcl/tcl8.5.9-src.tar.gz $ wget http://prdownloads.sourceforge.net/tcl/tk8.5.9-src.tar.gz $ tar xvf tcl8.5.9-src.tar.gz $ tar xvf tk8.5.9-src.tar.gz $ cd tcl8.5.9 tcl8.5.9 $ ./win/configure --prefix=/p tcl8.5.9 $ make && make install tcl8.5.9 $ cd ../tk8.5.9 tk8.5.9 $ ./win/configure --prefix=/p --with-tcl=`pwd`/../tcl8.5.9 tk8.5.8 $ make && make install
Download and build emacs from source:
$ wget http://ftp.gnu.org/gnu/emacs/emacs-23.3.tar.gz $ tar xvf emacs-23.3.tar.gz $ cd emacs-23.3 emacs-23.3 $ cd nt emacs-23.3/nt $ cmd /c "configure --prefix=/p --without-xpm \ --without-png --without-jpeg --without-tiff --without-gif" emacs-23.3/nt $ make && make install
Build my
win32_build
branch of Mozart. Note that I add the directory where I installed Git into the path. I also add the 'bin' directory of where I set Mozart to be installed.$ export PATH=$PATH:/c/git/bin:/p/bin $ git clone git://github.com/doublec/mozart.git $ cd mozart mozart $ git checkout -b win32_build origin/win32_build mozart $ cd .. $ mkdir build $ cd build build $ windlldir=/p ../mozart/configure --prefix=/p \ --with-inc-dir=/p/include --with-lib-dir=/p/lib \ --with-tcl=/p --with-tk=/p --disable-contrib-compat \ --disable-contrib --enable-modules-static \ --disable-doc --disable-chm build $ make && make install
Build my
win32_build
branch of the Mozart standard library:$ git clone git://github.com/doublec/mozart-stdlib.git $ cd mozart-stdlib mozart-stdlib $ git checkout -b win32_build origin/win32_build mozart-stdlib $ cd .. $ mkdir build-stdlib $ cd build-stdlib build-stdlib $ ../mozart-stdlib/configure --prefix=/p build-stdlib $ make && make install
You can now test Mozart by running the comand
oz
. This should startemacs
with a Mozart/Oz system running. You can evaluate an example by entering{Browse 1+1}
into the topmostemacs
pane and evaluating withCtrl+. Ctrl+l
. You'll need to set the OZEMACS environment variable to point to the location ofemacs
:$ export OZEMACS=/p/bin/emacs.exe $ oz
That's a large number of steps but it gives a complete Mozart/Oz environment. From there you can work through the tutorial. There's work to be done to make it easier and get more testing. One contributor is looking at creating a Visual Studio project to do the builds as well as to improve on the basic MingW support I've got working, so there's hope for less steps in the future.
The Mozart/Oz system is interesting and there's some neat projects written in it. A short list of some of them:
- BeerNet, a P2P network.
- TransDraw, a distributed shared drawing program. I run a live transdraw instance which you can connect too. Instructions here.
- Roads, a web application framework.
- EBL/Tk, an UI library that can do migration of user interface elements across the network.