rustler: Running `mix test` does not work on the first run (needs to compile twice)
[Modify the `mix.exs` file]
$ mix test
Compiling NIF crate :rustler_test (native/rustler_test)...
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
Compiling 221 files (.ex)
13:15:37.820 [warn] The on_load function for module Elixir.RustlerTest returned:
{:error, {:upgrade, 'Upgrade not supported by this NIF library.'}}
[Tests fail]
[Then, running again works]
$ mix test
[Tests succeed]
To make it work in travis CI I had to compile before running the tests:
- MIX_ENV=test mix compile
- mix test || travis_terminate 1
Same issue happens when trying to open the console with: iex -S mix
Rustler compiler is in the recommended order:
compilers: [:rustler, :phoenix, :gettext] ++ Mix.compilers,
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 16 (13 by maintainers)
@rafapaez yes, @hansihe and I have noticed this happening. The issue is that the
privdirectory needs to exist beforemix compilewill properly symlink it to the_builddirectory. The way I’ve gotten around this is by committing apriv/.keepso that theprivdir always exists.@scohen unfortunately, I don’t have access to
hex/cargofor releases.@hansihe can we get a new release?