[mercury-users] Two unrelated problems.

Michael Richter ttmrichter at gmail.com
Wed Nov 24 21:49:30 AEDT 2010


I've decided to pick up logic programming (again, technically, but I don't
really consider six weeks of Prolog 20 years ago valid experience) and
selected Mercury as my tool of choice.  What I've seen so far is very
impressive, but I have two problems I can't work out.

The first problem is the alternate back ends.  I can't get any of them to
work.  Let's take, for example, this source code (from the incomplete but
still very useful tutorial):

:- module hello.

:- interface.

:- import_module io.

:- pred main(io::di, io::uo) is det.

:- implementation.

main(IOState_in, IOState_out) :-
    io.write_string("Hello, World!\n", IOState_in, IOState_out).


If I issue *mmc --make hello*, I get the behaviour I expect.  In a
subdirectory called "Mercury" I get a tree full of files including generated
C files, object files, a bewildering variety of interim files, etc.  If,
however, I instead issue *mmc --erlang --make hello*, I get this:

$ mmc --erlang --make hello
Making Mercury/int3s/hello.int3
Making Mercury/ints/hello.int
Making Mercury/erls/hello.erl
** Error: file `Mercury/hrls/mercury__array.hrl' not found: file
`mercury__array.hrl' not found


Sure enough, if I look in *Mercury/hrls* there are no files at all.  It's an
empty directory.  If I retry this with *mmc --java --make hello*, I instead
get:

$ mmc --java --make hello
Making Mercury/int3s/hello.int3
Making Mercury/ints/hello.int
Making Mercury/javas/jmercury/hello.java
Making Java class files
Mercury/javas/jmercury/hello.java:45: package jmercury.runtime does not
exist
    jmercury.runtime.JavaInternal.progname = "hello";
                    ^
Mercury/javas/jmercury/hello.java:46: package jmercury.runtime does not
exist
    jmercury.runtime.JavaInternal.args = args;
                    ^
Mercury/javas/jmercury/hello.java:47: package jmercury.runtime does not
exist
    jmercury.runtime.JavaInternal.exit_status = 0;
                    ^
Mercury/javas/jmercury/hello.java:48: cannot find symbol
symbol  : variable benchmarking
location: class jmercury.hello
    benchmarking.ML_initialise();
    ^
Mercury/javas/jmercury/hello.java:51: package jmercury.runtime does not
exist
... error log truncated, see `hello.err' for the complete log.


Now I'm sure that I'm missing the blindingly obvious here, but I can't find
any actual instructions for building things with anything but the default
back-end.  The user's guide gives command line switches but doesn't talk
about, for instance, how to bring in the Mercury Java runtime files, nor
where to find the Erlang headers (and library), etc.  There are no .hrl
files in the mercury installation directory nor are there any .jar or .class
files.  I'm pretty much at a loss over where to go from here.

The second problem is less of one, but it's one I'd like to get solved at
some point.  I'm trying to run Mercury from a USB stick so I can carry it
with me and play with it in spare moments on whatever computer happens to be
handy.  The USB stick is not always on the same drive letter, of course, so
hard-coded paths are bad.  I've replaced hard-coded paths in all of the .bat
files to use an environment variable (that I set) instead.  This has not
worked.  In the process of trying to find the fast_asm.gc libraries the
compiler chokes because it's looking for them on a specific drive letter.  I
can't figure out where it's getting this path information from, however, so
I can't actually change it like I did the .bat files.  Could someone
knowledgeable of the Windows installation setup give me a clue on what I
need to change to make Mercury USB stick-ready?

-- 
"Perhaps people don't believe this, but throughout all of the discussions of
entering China our focus has really been what's best for the Chinese people.
It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20101124/1a564482/attachment.html>


More information about the users mailing list