Search code examples
smlsmlnjcm

CM.make cannot find file "smlnj-lib.cm"


When I try to use smlnj-lib.cm in a .cm file, I get this error:

I installed SML/NJ using Homebrew on MAC OS X 10.14.2. /usr/local/smlnj/bin is in .bash_profile, .bash_profile is updated.

sources.cm file:

Group is
driver.sml
errormsg.sml
tokens.sig
tokens.sml
tiger.lex
smlnj-lib.cm

I try to run it:

CM.make "sources.cm";

And get this error:

sources.cm:8.1-8.13 Error: Io: openIn failed on "smlnj-lib.cm", No such file or directory

Solution

  • If i recall, you are using the old compilation manager format, in the new compilation manager cm files which should be looked up relative to the standard ML installation directories should be prefixed by $/dir where smlnj-lib.cm exists in the root.

    directories without such a prefix will be looked up relative to the current directory.

    such as

    Group is
    driver.sml
    ...
    $/smlnj-lib.cm