Getting error while running iex -S mix phx.server

I am trying to run my project using command iex -S mix phx.server . However I am getting below error . I have already installed libsodium using sudo apt install libsodium-dev . I also have gcc , make running .

In file included from src/salty_nif.c:20:
/usr/lib/erlang/usr/include/erl_nif.h:123:14: note: ‘flags’ declared here
123 | unsigned flags;
| ^~~~~
src/salty_nif.c:2246:5: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc’ {aka ‘struct enif_func_t’} [-Wmissing-field-initializers]
2246 | SALTY_EXPORT_FUNC(randombytes_close, 0),
| ^~~~~~~~~~~~~~~~~
In file included from src/salty_nif.c:20:
/usr/lib/erlang/usr/include/erl_nif.h:123:14: note: ‘flags’ declared here
123 | unsigned flags;
| ^~~~~
/usr/bin/ld: cannot find -lerl_interface
collect2: error: ld returned 1 exit status
make: *** [Makefile:37: priv/salty_nif.so] Error 1
could not compile dependency :salty, “mix compile” failed. You can recompile this dependency with “mix deps.compile salty”, update it with “mix deps.update salty” or clean it with “mix deps.clean salty”
** (Mix) Could not compile with “make” (exit status: 2).
You need to have gcc and make installed. If you are using
Ubuntu or any other Debian-based system, install the packages
“build-essential”. Also install “erlang-dev” package if not
included in your Erlang/OTP version. If you’re on Fedora, run
“dnf group install ‘Development Tools’”.

Regards
Satyam

You are using probably OTP23 which doesn’t ship erl_interface anymore but ei instead.

Either use an older OTP version or a version of your library that is compatible with your version of OTP.

1 Like

Thanks NobbZ for your response . Please can you tell how to use older OTP version ?

Use asdf or kerl to switch versions. Make sure that your elixir is compatible with the OTP you choose.

1 Like

Thanks Nobbz . This was a problem due to version of elixir and OTP version . Now its working fine .