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

Volker Wysk post at volker-wysk.de
Fri Mar 22 16:42:06 AEDT 2019


Hi

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.


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'.

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



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.


Am Donnerstag, 21. März 2019, 05:31:33 CET schrieb Julien Fischer:
> On Wed, 20 Mar 2019, Volker Wysk wrote:
> > rm hello
> > LANG=C mmc --make hello --ml posix
> 
> Unless you have installed the library in the default installation
> directory (i.e. where Mercury's standard library is installed) then I
> would expect to also see the --mld option on the command line telling
> the Mercury compiler where the posix library is installed.

Yeah. See above.

> > I've tried it with --link-object posix_workarounds.o and --extra-library-
> > header posix_workarounds.h, like you've written. This works. But I think
> > this shouldn't be necessary to specify every time, after the library has
> > been correctly installed. Am I right?
> 
> That statment is correct.  The issue here is because you are in the same
> directory as the library source files you are *not* using the installed
> version of hte posix library, just recompiling its source files.
> 
> For reference:
> 
> To install the library using mmc --make (...)

I rather install it with mmake.


Bye
Volker




More information about the users mailing list