[m-users.] Can't compile sample programn

Julien Fischer jfischer at opturion.com
Fri Mar 22 18:05:02 AEDT 2019


Hi,

On Fri, 22 Mar 2019, Volker Wysk wrote:

> I've restarted from scratch with a fresh r.o.t.d.. I've encountered three 
> issues.
>
> 1. Installing Mercury:
>
>    cd /usr/local/src
>    tar xfz /usr/local/sw/Mercury/mercury-srcdist-rotd-2019-01-03.tar.gz
>    cd mercury-srcdist-rotd-2019-01-03
>
>    ./configure 2>&1 | tee /usr/local/sw/Mercury/configure.log
>    make PARALLEL=-j8
>    make PARALLEL=-j8 install 
>
> The last command leads to these errors:
>
> /usr/local/src/mercury-srcdist-rotd-2019-03-21/
> install_grade_dir.asm_fast.gc.prof/scripts/mgnuc --grade asm_fast.gc.prof 
> --c-debug --no-ansi   --       -fPIC -DMR_PIC \
> 	-c mercury_trace_browse.c -o mercury_trace_browse.pic_o
> mercury_event_scanner.l: In function ‘mercury_event_lex’:
> mercury_event_scanner.l:98:25: error: ‘mercury_event_lval’ undeclared (first 
> use in this function); did you mean ‘mercury_event_lex’?
> mercury_event_scanner.l:98:25: note: each undeclared identifier is reported 
> only once for each function it appears in
> mercury_event_scanner.l:99:32: error: ‘TOKEN_EVENT’ undeclared (first use in 
> this function)
> mercury_event_scanner.l:101:10: error: ‘TOKEN_SET’ undeclared (first use in 
> this function); did you mean ‘TOKEN_EVENT’?
> mercury_event_scanner.l:102:10: error: ‘TOKEN_IMPURE’ undeclared (first use in 
> this function); did you mean ‘TOKEN_SET’?
> mercury_event_scanner.l:103:10: error: ‘TOKEN_FUNCTION’ undeclared (first use 
> in this function); did you mean ‘TOKEN_SET’?
> mercury_event_scanner.l:104:10: error: ‘TOKEN_SYNTHESIZED’ undeclared (first 
> use in this function)
> mercury_event_scanner.l:105:10: error: ‘TOKEN_BY’ undeclared (first use in 
> this function); did you mean ‘TOKEN_SET’?
> mercury_event_scanner.l:107:10: error: ‘TOKEN_LPAREN’ undeclared (first use in 
> this function); did you mean ‘TOKEN_IMPURE’?
> mercury_event_scanner.l:108:10: error: ‘TOKEN_RPAREN’ undeclared (first use in 
> this function); did you mean ‘TOKEN_LPAREN’?
> mercury_event_scanner.l:109:10: error: ‘TOKEN_COMMA’ undeclared (first use in 
> this function); did you mean ‘TOKEN_BY’?
> mercury_event_scanner.l:112:32: error: ‘TOKEN_COLON’ undeclared (first use in 
> this function); did you mean ‘TOKEN_COMMA’?
> mercury_event_scanner.l:121:32: error: ‘TOKEN_ID’ undeclared (first use in 
> this function); did you mean ‘TOKEN_BY’?
> mercury_event_scanner.l:130:32: error: ‘TOKEN_SYM’ undeclared (first use in 
> this function); did you mean ‘TOKEN_BY’?
> mercury_event_scanner.l:147:10: error: ‘GARBAGE’ undeclared (first use in this 
> function)
> /tmp/mmake.aY2SQr:1352: recipe for target 'mercury_event_scanner.o' failed
>
> I've made sure beforehand, that /usr/local/mercury-rodt-2019-03-21 can be 
> written. But then I've added "sudo" to the command, like this:
>
>    sudo make PARALLEL=-j8 install
>
> ... and this works.

I'm not sure what's causing that; is this still on you Ubuntu system?

> 2. Compiling and installing the posix library:
>
>   cd extras/posix
>   mmake realclean
>   LANG=C mmake depend
>
> The "mmake depend" step leads to:
>
>   make: Nothing to be done for 'depend'.

Note that as of rotd-2019-03-21, the posix library will be built by
standard make and mmc --make  rather than mmake.  (The Mmakefile in that
directory now simply redirects its work to mmc --make.)

See: https://github.com/Mercury-Language/mercury/commit/dcf7945280caa67f032532702033d4792f4f7360

The above message for depend target is now what is expected.

> Then:
>
>   mmake 
>
> ... which yields:
>
>   Making Mercury/os/posix.write.o
>   ** Error: file `posix_workarounds.o' not found
>   ** Error making `libposix.a'.
>   Makefile:16: recipe for target 'build' failed
>
> Work around it:
>
>   mmake posix_workarounds.o
>   mmake
>
> This works. The "Nothing to be done for 'depend'" looks erroneous.
>
> Then:
>
>   sudo mmake install

That's strange.  The normal Makefile has a rule to build
posix_workaround.o but when that's invoked from mmake it doesn't work.
(I've committed a workaround for the problem.)

> 3. Compiling the sample program of the posix library. hello1.m is a copy of 
> hello.m form the posix library. It's in a separate directory:
>
>    mmc --make hello1 --ml posix
>    mercury_compile: error: the library `posix' cannot be found in grade 
> `asm_fast.gc'.
>
> Whereas this works:
>
>    mmc --make hello1  \
>    --mld /usr/local/mercury-rotd-2019-03-21/extras/lib/mercury/ \
>    --ml posix
>
> You shouldn't need to specify the library directory, since it is installed at 
> the standard location.

extras/lib/mercury is not a directory the compiler knows about by
default.  The only directory that it does know about by default is the
one where the standard library and runtime library are installed.
(/usr/local/mercury-rotd-2019-3-21/lib/mercury for the above
installation.)

Julien.


More information about the users mailing list