[m-rev.] diff: fix bootchecking problems in the Java grade

Julien Fischer jfischer at opturion.com
Sat Oct 21 01:22:19 AEDT 2017

The following allows bootchecking in the Java grade to progress
past stage 2.  On my machine the JVM aborts due to a stack overflow
somewhere in the stage 3 library.  (IIRC, that can be setting a larger
stack size for the JVM -- I'll fix this separately.)


Fix bootchecking problems in the Java grade.

      Generate a new wrapper script for the stage 2 compiler that sets
      the CLASSPATH correctly.

      Don't pass any of the Mercury runtime options to the stage 2 compiler
      since the Java verison of the Mercury runtime doesn't currently understand


diff --git a/tools/bootcheck b/tools/bootcheck
index 93c6f49..ea941aa 100755
--- a/tools/bootcheck
+++ b/tools/bootcheck
@@ -1140,6 +1140,30 @@ then
          cd $root

+    # In the java grade replace the generated mercury_compile wrapper script
+    # will not set the CLASSPATH correctly when building stage 3.  Replace it
+    # with one that will.
+    #
+    if test "$grade" = "java"
+    then
+cat > $root/$stage2dir/compiler/mercury_compile << EOF
+case \$WINDIR in
+   '') SEP=':' ;;
+   *)  SEP=';' ;;
+exec "\$JAVA" jmercury.mercury_compile "\$@"
+       # The Java version of the Mercury runtime does not currently support
+       # most of the runtime options and will abort if they are passed to it.
+       export MERCURY_OPTIONS
+    fi

More information about the reviews mailing list