Mercury Bugs - mercury
View Issue Details
0000108mercuryBugpublic2009-09-28 11:382009-11-23 22:11
Reportergloomdemon 
Assigned Towangp 
PrioritynormalSeverityminorReproducibilityN/A
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000108: invalid java path with mercury and mingw
DescriptionMercury Compiler, version rotd-2009-09-15
mingw with gcc4.4 on windows vista

while compiling java grade, mercury compiler uses invalid path:
$ mmc --java -v --make family
...
% Invoking system command `/c/Java/jdk1.6.0_12/bin/javac -classpath :c:/mingw/me
rcury/lib/mercury/lib/java/mer_rt.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_
std.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_mdbcomp.jar:c:/mingw/mercury/l
ib/mercury/lib/java/mer_browser.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_ss
db.jar -sourcepath Mercury\javas -d Mercury\classs -J-Xmx256m Mercury\javas\jmer
cury\family.java'...
...
Error: system command received signal 1.

,must be:

% Invoking system command `c:/Java/jdk1.6.0_12/bin/javac -classpath c:/mingw/...
with c:\ and no : after -classpath or dot before :

% Invoking system command `c:/Java/jdk1.6.0_12/bin/javac -classpath .:c:/mingw/...

=== ===

after compiling and linking created sh file incorrect.

#!/bin/sh
DIR=${0%/*}
CLASSPATH=$DIR/Mercury\classs:$CLASSPATH:c:/mingw/mercury/lib/mercury/lib/java/mer_rt.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_std.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_mdbcomp.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_browser.jar:c:/mingw/mercury/lib/mercury/lib/java/mer_ssdb.jar
export CLASSPATH
JAVA=${JAVA:-/c/Windows/system32/java}
exec $JAVA jmercury.family "$@"

,must be:

CLASSPATH=$DIR/Mercury/classs:
TagsNo tags attached.
Attached Files

Notes
(0000191)
wangp   
2009-09-28 22:56   
Thanks for testing.

I thought javac on Windows needs ";" separators instead of ":", as colons are
use to denote drive letters?

I will commit something for the CLASSPATH problem.
(0000192)
gloomdemon   
2009-09-29 03:35   
Yes, javac works normally with ":" as path delimiter, but better use ";".

Configure script under mingw also can not use java.exe (javac.exe) with spaces in path (i.e. c:/program files/java/jdk/javac.exe), and disable java grade.
(0000193)
wangp   
2009-09-30 03:49   
I have committed fixes for the first two problems you mentioned.
(0000194)
wangp   
2009-10-01 03:26   
Committed further fixes today, except for the problem with spaces in the path.
(0000216)
gloomdemon   
2009-11-22 10:50   
Hi, i get the rotd-2009-11-12 and try to install with java grade under mingw. And get error while linking java class files into grade library: path not found. This old error with /c/Java/jdk1.6.0_12/bin/javac, to check this, i use new compiler mmc --very-verbose --java hello.m and get:

% Compiling `jmercury\hello.java':
% Invoking system command `/c/Java/jdk1.6.0_12/bin/javac -classpath c:/mingw/mer
cury/lib/mercury/lib/java/mer_rt.jar;c:/mingw/mercury/lib/mercury/lib/java/mer_s
td.jar;c:/mingw/mercury/lib/mercury/lib/java/mer_mdbcomp.jar;c:/mingw/mercury/li
b/mercury/lib/java/mer_browser.jar;c:/mingw/mercury/lib/mercury/lib/java/mer_ssd
b.jar -J-Xmx256m jmercury\hello.java'...
??????? ?? ??????? ????? ????????? ????.
Error: system command received signal 1.
% Touching `hello.java_date'... done.

I decided recompile mmc with JAVAC=javac. I tried JAVAC='javac' ./configure ... and add JAVAC=javac to Mmake.params, but configure converts it to /c/Java/jdk1.6.0_12/bin/javac, so i hack configure and make new mmc. While making java grade (mmake LIBGRADES='java' install) get new error:

Making Java class files
Mercury\javas\jmercury\array.java:779: illegal unicode escape
// Mercury\opts\univ.opt:8

file array.java at line 779 contains:

// Mercury\opts\univ.opt:8
          {
            V_4_38 = univ.type_to_univ_2_p_1(TypeInfo_for_T_28, V_12_12);
          }

Mercury added comments on lines while compiling .m to .java but this is old java bug:

http://bugs.sun.com/view_bug.do?bug_id=4364486
http://bugs.sun.com/view_bug.do?bug_id=4324927
(0000217)
gloomdemon   
2009-11-22 11:02   
Converting comment like // Mercury\opts\univ.opt:8 to // Mercury\\opts\\univ.opt:8 solves this problem.
(0000218)
wangp   
2009-11-23 22:11   
Thanks for the report. Committed a patch just then.

Issue History
2009-09-28 11:38gloomdemonNew Issue
2009-09-28 22:56wangpNote Added: 0000191
2009-09-29 03:35gloomdemonNote Added: 0000192
2009-09-30 03:49wangpNote Added: 0000193
2009-09-30 03:49wangpStatusnew => assigned
2009-09-30 03:49wangpAssigned To => wangp
2009-10-01 03:26wangpNote Added: 0000194
2009-10-01 03:26wangpStatusassigned => resolved
2009-10-01 03:26wangpResolutionopen => fixed
2009-11-22 10:50gloomdemonNote Added: 0000216
2009-11-22 10:50gloomdemonStatusresolved => feedback
2009-11-22 10:50gloomdemonResolutionfixed => reopened
2009-11-22 11:02gloomdemonNote Added: 0000217
2009-11-23 22:11wangpNote Added: 0000218
2009-11-23 22:11wangpStatusfeedback => resolved
2009-11-23 22:11wangpResolutionreopened => fixed