Can't compile slime on 1.15.4 due to strange error

The repository GitHub - slime-lang/slime: Minimalistic HTML templates for Elixir, inspired by Slim. can’t be compiled with Elixir 1.15.4 / OTP 25 and I am at a loss for why. I don’t think it’s an issue in the slime repository and is somehow an issue with my setup.

After running the following:

git clone
mix deps.get
mix test # or iex -S mix

I get this error:

** (UndefinedFunctionError) function :neotoma.file/2 is undefined (module :neotoma is not available)
    (neotoma 1.7.3) :neotoma.file(~c"/tmp/slime/src/slime_parser.peg", [transform_module: :slime_parser_transform])
    tasks/compile.peg.exs:37: Mix.Tasks.Compile.Peg.compile_grammar/2
    (mix 1.15.4) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.15.4) lib/mix/tasks/compile.all.ex:124: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.15.4) lib/mix/tasks/compile.all.ex:104: Mix.Tasks.Compile.All.compile/4
    (mix 1.15.4) lib/mix/tasks/compile.all.ex:93: Mix.Tasks.Compile.All.with_logger_app/2
    (mix 1.15.4) lib/mix/tasks/compile.all.ex:56:
    (mix 1.15.4) lib/mix/task.ex:447: anonymous fn/3 in Mix.Task.run_task/5

This is despite neotoma being declared as a dependency inside mix.exs:

  def deps do
      # packrat parser-generator for PEGs
      {:neotoma, "~> 1.7"},

When trying to explicitly load it using :code.ensure_loaded(:neotoma), I get {:error, :nofile}. I also get the same when trying to explicitly load the compiled beam file at _build/dev/lib/neotoma/ebin/neotoma.beam.

The environment doesn’t seem to have a problem parsing the BEAM file, which was compiled by mix as normal:

iex(1)> :beam_lib.chunks('_build/dev/lib/neotoma/ebin/neotoma.beam', [:abstract_code])           
    abstract_code: {:raw_abstract_v1,
       {:attribute, {1, 1}, :file,
        {~c"/tmp/slime/deps/neotoma/src/neotoma.erl", 1}},
       {:attribute, {1, 2}, :module, :neotoma},
       {:attribute, {2, 2}, :author, ~c"Sean Cribbs"},
       {:attribute, {3, 2}, :export, [file: 1, file: 2, bootstrap: 0]},
       {:attribute, {4, 2}, :export, [main: 1]},
       {:attribute, {10, 2}, :type,

And it clearly exists and exports file/2, so why isn’t this loadable?

Probably related to 1.15’s new code paths pruning algorithm.

Maybe put the dependency in extra_applications?

1 Like

Hi @iamwhite

How do you solve this issue ?

I forked the repository and added neotoma to its list of extra_applications.