[m-users.] Using the. 'Extras' modules, specifically posix

Sean Charles (emacstheviking) objitsu at gmail.com
Wed Apr 21 06:50:55 AEST 2021


I followed the instructions on how to build this library.
It installed lots of files into here, for example:

    /usr/local/mercury-rotd-2021-04-15/extras/lib/mercury/inc/posix.kill.mh

When I try to import it I get an error, it can’t find it. The build process seemed to know where to put it so how do I tell it where to find it, I possibly naively assumed it would be automatic?

I have —zero— knowledge of Mmake and any command line magic.

Here is my meagre excuse of a program, for educational purposes I wanted to write a little app that could scan the `cwd` for all files ending in `.m` then remove any build files. Yes, I know I can tell it to explicitly use a folder and also I could write a makefile and do `make clean` but then I wouldn’t be learning Mercury would I?

:- module mwipe.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module dir, list, posix, string.

main(!IO) :-
    dir.current_directory(D, !IO),
    (   D = ok(Dir),
        io.format("looking for crufty files in %s...\n", [s(Dir)], !IO)
    ;
        D = error(_),
        io.format("oops: \n", [], !IO)
    ).

And the error:

    mercury_compile: cannot find `posix.int' in directories .,
      /usr/local/mercury-rotd-2021-04-15/lib/mercury/ints


But I know the module got installed into:

    /usr/local/mercury-rotd-2021-04-15/extras/

I also tried this command, after trying to search the archives,

    $ EXTRA_LIBRARIES=posix mmc mwipe.m  
    mercury_compile: error: the library `posix' cannot be found in grade `hlc.gc’.

So I am a little mystified as to what is ‘due process’ to tell it how to find posix. I also want to play around with the graphics stuff and all the other libraries too so this is going to be something I need to master early on!

Thanks,
Sean

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210420/98f8acf4/attachment.html>


More information about the users mailing list