Jape Installation
jape_on_tiger.png

UPDATE—11 March 2009
Jape now works on Tiger (Apple's Mac OS X 10.4). Dr. Bornat sent me a new version compiled by his collaborator, Bernard Sufrin, and it worked fine. I assume jape.org.uk will soon add this version for download.

I wanted to try out Jape, a proof helper (available at jape.org.uk) designed and maintained by Richard Bornat, with the latest versions compiled using OCaml. I couldn't get the precompiled binary to run on Mac OSX 10.4.11. This article lists some of the problems that arose and some solutions I tried (with considerable help from Richard Bornat).

Curiously some older versions of Jape (written before Leopard's introduction) also didn't run on the MacBook Pro, which may mean it's a problem specific to my laptop or with a particular version of Java, and not the fact that I'm not running Leopard. I also confirmed that the latest Jape doesn't run on a PPC Mac.

Richard Bornat notes on the Jape Web site:

(2nd Feb 2009) Mac OS X stuff again (sigh!). Jeff Lindstrom pointed out that (a) Jape doesn't run on OS X 10.4 and (b) it doesn't even build on 10.4. I'm working on the problem. Meantime, there's a new how-to-build file for OS X which acknowledges the problem and at least tells you what to do with JarBundler.

I'm editing this entry to make it better organized and less of the rambling "real time" journal it started off as. There is still some infelicitous wording including inconsistent tense, and my formatting needs some work.

Once the problem is solved I'll shorten the article even more to concentrate on the germane points.

Table of Contents

Trying the Jape Binary

jape-gui-message.png

Jape says: "Dispatcher sees null line — is jape_engine ok?"

I downloaded the latest Jape binary for Mac OSX, but when I attempted to start up Jape 7.6.4 (or 7.6.3) on my Mac (running Tiger) I would get the GUI error message, "Dispatcher sees null line — is jape_engine ok?" Choosing "Continue" just brought up the error window again.

I'm using an Intel MacBook Pro that's two or three years old, Mac OS X10.4.11, and the latest update for Java ("Java for Mac OS X 10.4, Release
7").

I tried both the latest version of Jape and the second-last version. At one point I restarted the laptop and I got to the point where I could explore all the "Jape" menu choices, but the "About Jape" (which shows the version) was the only choice not greyed out (aside from the general Mac OSX menu choices such as "Services").

Could it be a problem that I'm running Tiger not Leopard?

Suggestion: Compile Jape Source Code

Possible Solution: Compile Jape

Richard Bornat promptly replied to an E-mail and noted that there was a GUI portion (written in Java) and a Jape engine (written in OCaml). One possibility is that Java isn't being so universal as it might claim to be (I'm running Java 2 version 1.5.0_16), or there could be an OCaml issue.

I did some more exploring and discovered that older versions up to 7.4.11 (I didn't try them all) seemed to work while 7.5.1a and beyond brought up the same error message as the latest versions.

Richard Bornat suggested I compile from the source code for Jape written in OCaml, but this required some preliminary steps.

Problem: OCaml 3.11 binary doesn't work with Tiger

The first task was to get the OCaml compiler working before I could try compiling the Jape source code.

Getting the compiler running turned out to be a bit of a challenge as the latest version wasn't compatible with my OS.

According to http://caml.inria.fr/ocaml/release.en.html, "The most recent version of Objective Caml is 3.11.0. It was released on 2008-12-04. "

Unfortunately the precompiled binaries for Mac (Intel or PPC) were "compiled on Mac OS 10.5.5 with XCode tools v3.1.1 (not compatible with Mac OS 10.4.x)," a slightly ambiguous statement but I concluded the binaries (as opposed to XCode tools v3.1.1) were not compatible with Tiger.

There is, however: "Source tarball (.tar.gz) for compilation under Unix (including Linux and MacOS X) and Microsoft Windows (including Cygwin)."

Dead End: Trying OCaml 3.09 Binary

Possible Solution: Try OCaml 3.09 Binary

So, it looked like I have two options for getting OCaml running (even before I looked at compiling Jape):

  1. Download the latest source code and compile it, or
  2. Download one of the previous versions of the precompiled binaries.

I didn't want to try compiling OCaml if I could help it, so I looked at earlier versions of the binaries.

Problem: Needed XTools

Leopard shipped in October 2007, so tried version 3.09 of OCaml from September 2006. The Intel disk image is ocaml-3.09.3-intel.dmg. The ReadMe.txt said:

This package installs Objective Caml version 3.09.3.
You need Mac OS X 10.4.x (Tiger), with X11 and the
XCode tools (v2.2) installed.

I ran the OCaml installer not sure if I had XTools. Although a simple factorial program worked, the README_BUILD_MACOSX_JAPE.rtf in the Jape source download made it clear (based on example folders) that I didn't have XTools installed.

I went to http://connect.apple.com (Apple's site for developers) and downloaded XCode 2.2.1 (Downloads > Developer Tools, then scroll way down). It turned out this was an update and XCode 2.2 (also available on that page) had to be installed first.

Successful task: Making "Ant" variables visible

I followed the instructions README_BUILD_MACOSX_JAPE.rtf to modify .profile so Ant would be visible. That seemed to work.

The "ocamlbuild" problem

Problem: Jape compilation requires "ocamlbuild"

I next typed in make local, which “builds the engine and the GUI interface, bundles them together and puts them in ./build/Jape.app.”

This returned:

$ make local
make engineclean engine GUIclean GUI
cd ../camlengine; make clean OS=OSX
rm -fr _buildOSX *.native
cd ../camlengine; make jape_engine OS=OSX
\
ocamlbuild -build-dir _buildOSX -lib unix -no-links main.native; \
rm -f _buildOSX/jape_engine; ln -s main.native _buildOSX/jape_engine
/bin/sh: line 1: ocamlbuild: command not found
ln: _buildOSX/jape_engine: No such file or directory
make[2]: *** [jape_engine] Error 1
make[1]: *** [engine] Error 2
make: *** [local] Error 2

Possible Solution: Trying OCaml 3.10

The error message, /bin/sh: line 1: ocamlbuild: command not found, would seem to be key. The changes page indicates that ocamlbuild was introduced in OCaml 3.10.0. I'm using 3.09.3.

I download ocaml-3.10.2-intel.dmg.

Problem: OCaml 3.10 binary also requires Leopard

ReadMe.txt says:

This package installs Objective Caml version 3.10.2.
You need Mac OS X 10.5.x (Leopard), with X11 and the
XCode tools (v3.x) installed.

Compiling OCaml 3.11

Possible solution: Compile OCaml 3.11

If the binaries with the ocamlbuild command won't work then I might as well compile the latest version of the Ocaml source code: ocaml-3.11.0.tar.gz. (Check the download page for updates.)

Checking the prerequisites

The INSTALL file's first three prerequisites are:

  • The GNU C compiler gcc is recommended, as the bytecode

interpreter takes advantage of gcc-specific features to enhance
performance. gcc is the standard compiler under Linux, MacOS X,
and many other systems.

  • Under MacOS X 10.5, you need version 3.1 or later of the XCode

development tools. The version of XCode found on MacOS X 10.5
installation media causes linking problems. XCode updates
are available free of charge at http://developer.apple.com/tools/xcode/

  • Under MacOS X up to version 10.2.8, you must raise the limit on the

stack size with one of the following commands:

limit stacksize 64M # if your shell is zsh or tcsh
ulimit -s 65536 # if your shell is bash

Quickly typing gcc in the Terminal produces:

i686-apple-darwin8-gcc-4.0.1: no input files

This is a good sign.

The next two points quoted above don't directly address Tiger, although at least post-Tiger and pre-Tiger are mentioned.

Configure the OCaml 3.11 system (successful)

Next:

1- Configure the system. From the top directory, do:

./configure

This generates the three configuration files "Makefile", "m.h" and "s.h"
in the config/ subdirectory.

Typing ./configure returns the reassuring bulletin, ** Objective Caml configuration completed successfully ** (and the required files are indeed created).

Build OCaml byte compiler for first time (successful)

2- From the top directory, do:

make world

This builds the Objective Caml bytecode compiler for the first time.
This phase is fairly verbose; consider redirecting the output to a file:

make world > log.world 2>&1 # in sh
make world >& log.world # in csh

I confidently typed in the first of those last two options, pressed return, and no error message was returned either on screen or in the resulting log.world file.

Bootstrap the system (successful)

Next:

3- (Optional) To be sure everything works well, you can try to
bootstrap the system —- that is, to recompile all Objective Caml
sources with the newly created compiler. From the top directory, do:

make bootstrap

or, better:

make bootstrap > log.bootstrap 2>&1 # in sh
make bootstrap >& log.bootstrap # in csh

The "make bootstrap" checks that the bytecode programs compiled with
the new compiler are identical to the bytecode programs compiled with
the old compiler. If this is the case, you can be pretty sure the
system has been correctly compiled. Otherwise, this does not
necessarily mean something went wrong. The best thing to do is to try
a second bootstrapping phase: just do "make bootstrap" again. It will
either crash almost immediately, or re-re-compile everything correctly
and reach the fixpoint.

Log reveals:

make compare
Fixpoint reached, bootstrap succeeded.

Building the native-code compiler (apparently successful)

4- If your platform is supported by the native-code compiler (as
reported during the autoconfiguration), you can now build the
native-code compiler. From the top directory, do:

make opt
or:
make opt > log.opt 2>&1 # in sh
make opt >& log.opt # in csh

Well, let's give it a try. After a while the operation is finished and the log doesn't really end with a dramatic flourish of any kind.

Ignore fast compile option

The next step is optional, for those who “want to compile fast versions of the Objective Caml compilers.”

Not essential today.

Install the OCaml system (apparently successful)

Next:

6- You can now install the Objective Caml system. […]
From the top directory, become superuser and do:

umask 022 # make sure to give read & execute permission to all
make install

In the ocamlbuild setting instead of make install do:

./build/install.sh

The last part confuses me but let me try the umask 022 and make install.

They seem to turn out fine (as long as I prefix sudo to the commands), and ./build/install.sh with sudo also seems to go fine.

Clean up (apparently successful)

Next: “7- Installation is complete. Time to clean up. From the toplevel directory, do 'make clean'.”

Step 8 is optional and involves editing and a debugging interface. I'll ignore that for now.

Step 9 says what one shouldn't do: “do *not* strip the ocamldebug and ocamlbrowser executables.”

The remainder of the INSTALL help file talks about possible problems. So, first, let me try to compile the latest Jade source file.

Compiling Jape: JarBundler Needed

Compiling Jape: "JarBundler" can't be found

As I mentioned before, I downloaded Jape's latest source file (jape.source.v7_d6_4.tgz) from the source code directory.

Going through README_BUILD_MACOSX_JAPE.rtf I've done the preliminaries so it's time to try step 3 again:

3. In the directory where you found this file (japesource/MacOSX):

   make local 
   -- builds the engine and the GUI interface, bundles them together and puts them in 
        ./build/Jape.app

   make run
   -- to try it out. If it works, move build/Jape.app where you like

The sad news:

BUILD FAILED
[...]/jape.source/MacOSX/build.xml:5: taskdef class net.sourceforge.jarbundler.JarBundler cannot be found

[...]

BUILD FAILED
[...]/jape.source/MacOSX/build.xml:5: taskdef class net.sourceforge.jarbundler.JarBundler cannot be found

Total time: 0 seconds
make[1]: *** [GUI] Error 1
make: *** [local] Error 2

Solution: Install JarBundler (successful)

After confusing Apple's GUI-led Jar Bundler and SourceForge's line command JarBundler I downloaded JarBundler from the developer's page and installed it.

The good news is it solves the jarbundler problem.

Jape Engine Issue

Jape compilation: jape_engine can't be found

The bad news is there's another problem:

BUILD FAILED
[…]/jape.source/MacOSX/build.xml:31: Warning: Could not find file […]/jape.source/camlengine/_buildOSX/jape_engine to copy.

New makefile

Richard sends me a revised Makefile for jape.source/camlengine, and suggests I type make local run while in jape.source/MacOSX.

Original Makefile produces strange jape_engine alias

I reply:

With both original and modified Makefile in jape.source/MacOSX I get:

BUILD FAILED
/Users/jeff/Documents/OCaml/downloads/Jape/jape.source/MacOSX/build.xml:31:
Warning: Could not find file
/Users/jeff/Documents/OCaml/downloads/Jape/jape.source/camlengine/_buildOSX/jape_engine
to copy.

With the original Makefile the required jape.source/camlengine/_buildOSX
folder is created with three files: _log, jape_engine, and sanitize.sh.

However, jape_engine is an alias pointing to "main.native," which sounds
like a Java method not a file name. (Finder doesn't like it.)

The _log file says:

### Starting build.
# Compilation unsuccessful.

Revised Makefile results in no _buildOSX folder at all

I also note:

With the revised Makefile no _buildOSX folder is created at all (at least none can be seen at the end).

Revised Makefile #2 and a brand new LegacyMakefile

Richard sends me a Drop LegacyMakefile and revised Makefile for jape.source/camlengine. I type make local in
jape.source/MacOSX.

I'm a bit confused by his comment that: "Provided you don't have ocamlbuild, they will build jape_engine the old way and put it in the right place."

Result: jape_engine file still has "main.native" alias

I reply:

With the new Makefile run the _buildOSX folder still ends up with _log and
jape_engine, but drops sanitize.sh, and adds _digests, main.ml, and
main.ml.depends.

The jape_engine file is still an alias pointing to "main.native," and the
error message in the console is still:

BUILD FAILED
/Users/jeff/Documents/OCaml/downloads/Jape/jape.source/MacOSX/build.xml:31:
Warning: Could not find file
/Users/jeff/Documents/OCaml/downloads/Jape/jape.source/camlengine/_buildOSX/jape_engine
to copy.

The _log says:

### Starting build.
# Target: main.ml.depends, tags: { extension:ml, file:main.ml, ocaml,
ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules main.ml > main.ml.depends
+ /usr/local/bin/ocamldep.opt -modules main.ml > main.ml.depends
/usr/local/bin/ocamldep.opt: unknown option ‘-modules’.
Usage: ocamldep [-I <dir>] [-native] <files>
-I <dir> Add <dir> to the list of include directories
-native Generate dependencies for a pure native-code project (no .cmo
files)
-pp <command> Pipe sources through preprocessor <command>
-slash (for Windows) Use forward slash / instead of backslash \ in
file paths
-version Print version and exit
-help Display this list of options
—help Display this list of options
Command exited with code 2.

I'm using OCaml 3.11, which does have ocamlbuild. I'm not sure from your
comment if I should revert to OCaml 3.09, which doesn't have ocamlbuild.

Version confusion (3.09 vs 3.11) and ocamlbuild

It turns out Richard thought I was still using OCaml 3.09. The Makefile and LegacyMakefile were designed to compensate for 3.09's lack of ocamlbuild.

I replied that I switched to OCaml 3.11 in order to use ocamlbuild and it appears the compilation and installation of that version of OCaml worked even though I was on Tiger.

He wrote that: “If 3.11 runs under Tiger (which I doubt) then you have an OCaml problem, no longer a Jape build problem.”

Checking _buildOSX/_log

Comparing versions of _buildOSX/_log, Richard's successful run is:

### Starting build.
# Target: main.ml.depends, tags: { extension:ml, file:main.ml,  
ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules main.ml > main.ml.depends
# Target: dialogue.mli.depends, tags: { extension:mli,  
file:dialogue.mli, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules dialogue.mli >  
dialogue.mli.depends
# Target: dialogue.cmi, tags: { byte, compile, extension:mli,  
file:dialogue.mli, interf, ocaml, quiet }
/usr/local/bin/ocamlc.opt -c -o dialogue.cmi dialogue.mli
# Target: main.cmo, tags: { byte, compile, extension:ml,  
file:main.ml, implem, ocaml, quiet }
/usr/local/bin/ocamlc.opt -c -o main.cmo main.ml
# Target: dialogue.ml.depends, tags: { extension:ml,  
file:dialogue.ml, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules dialogue.ml > dialogue.ml.depends
# Target: alert.ml.depends, tags: { extension:ml, file:alert.ml,  
ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules alert.ml > alert.ml.depends
# Target: alert.mli.depends, tags: { extension:mli, file:alert.mli,  
ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules alert.mli > alert.mli.depends
# Target: alert.cmi, tags: { byte, compile, extension:mli,  
file:alert.mli, interf, ocaml, quiet }
/usr/local/bin/ocamlc.opt -c -o alert.cmi alert.mli
# Target: japeserver.ml.depends, tags: { extension:ml,  
file:japeserver.ml, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules japeserver.ml >  
japeserver.ml.depends
# Target: japeserver.mli.depends, tags: { extension:mli,  
file:japeserver.mli, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules japeserver.mli >  
japeserver.mli.depends
# Target: box.mli.depends, tags: { extension:mli, file:box.mli,  
ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules box.mli > box.mli.depends
# Target: displayclass.mli.depends, tags: { extension:mli,  
file:displayclass.mli, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules displayclass.mli >  
displayclass.mli.depends
# Target: displayfont.mli.depends, tags: { extension:mli,  
file:displayfont.mli, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules displayfont.mli >  
displayfont.mli.depends
# Target: moresys.mli.depends, tags: { extension:mli,  
file:moresys.mli, ocaml, ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules moresys.mli > moresys.mli.depends

He notes that these commands are all generated by ocamlbuild.

Possible ocaml command problem

Unknown ocamldep.opt -modules option

My _log (whether using the revisede MakeFile #2 and LegacyMakeFile, or just the original MakeFile) is:

### Starting build.
# Target: main.ml.depends, tags: { extension:ml, file:main.ml, ocaml,
ocamldep, quiet }
/usr/local/bin/ocamldep.opt -modules main.ml > main.ml.depends
+ /usr/local/bin/ocamldep.opt -modules main.ml > main.ml.depends
/usr/local/bin/ocamldep.opt: unknown option `-modules'.
Usage: ocamldep [-I <dir>] [-native] <files>
  -I <dir>  Add <dir> to the list of include directories
  -native   Generate dependencies for a pure native-code project (no .cmo
files)
  -pp <command>  Pipe sources through preprocessor <command>
  -slash   (for Windows) Use forward slash / instead of backslash \ in
file paths
  -version  Print version and exit
  -help  Display this list of options
  --help  Display this list of options
Command exited with code 2.

To do

Check if multiple versions of ocamldep

I'm going to look at http://osdir.com/ml/programming.tools.omake.general/2007-08/msg00034.html in more detail tomorrow. It seems to suggest a possible problem with different versions of ocamldep (which would make sense this I did try different versions of ocamldep, and would be consistent with Richard's suggestion that this is an Ocaml not jape_engine issue).

Confusingly:

MBP:/bin jeff$ ocaml -version
The Objective Caml toplevel, version 3.11.0
MBP:/bin jeff$ ocamldep -version
ocamldep, version 3.11.0
MBP:/bin jeff$ ocamlfind ocamldep -version
-bash: ocamlfind: command not found

Confirm build.xml excision is irrelevant

I also noticed that /MacOSX/build.xml contains the lines:

[...]        
        <!-- next bit deleted for 10.5 release 2
        <delete file="build/Jape.app/Contents/MacOS/JavaApplicationStub"/>
        <exec executable="ln">
            <arg line="-s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub"/>
            <arg value="build/Jape.app/Contents/MacOS/JavaApplicationStub"/>
        </exec>
         -->
[...]

—but this perhaps is not significant. Restoring the lines did not solve the problem (in a brief test).

Comments

Feel free to leave a comment. A general wikidot.com log-in will be required, but you don't have to be a member of the Echolocation wiki. You may wish to read recent comments too (two at this point, including one from me).

Add a New Comment
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License