1

I am trying to run iex -S mix phx.server . But I am getting below error . I have installed libsodium using sudo apt install libsodium-dev but it didn't work . I also have make , gcc, erlang-dev installed

Elixir version : Elixir 1.11.2 (compiled with Erlang/OTP 23)

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:2244:5: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc’ {aka ‘struct enif_func_t’} [-Wmissing-field-initializers]
 2244 |     SALTY_EXPORT_FUNC(randombytes_buf, 1),
      |     ^~~~~~~~~~~~~~~~~
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:2245:5: warning: missing initializer for field ‘flags’ of ‘ErlNifFunc’ {aka ‘struct enif_func_t’} [-Wmissing-field-initializers]
 2245 |     SALTY_EXPORT_FUNC(randombytes_buf_deterministic, 2),
      |     ^~~~~~~~~~~~~~~~~
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'".

I referred to the below posts but it didn't work out .

could not compile dependency :salty, "mix compile" failed

https://elixirforum.com/t/could-not-compile-dependency-salty-mix-compile-failed/24538

satyam
  • 71
  • 1
  • 4
  • 1
    Add more information, show your deps from mix.exs and any possible info otherwise everyone will downvote it. – Yatender Singh Jan 15 '21 at 12:14
  • try updating `rebar` – Segfault Jan 15 '21 at 14:16
  • I think the important bit is this line: `/usr/bin/ld: cannot find -lerl_interface`. When compiling NIFs, libraries have to link in an interface for erlang, and I've had problems with some of them finding the library to link with OTP 23. I haven't looked into it too much as it wasn't a priority for me at the time. If you have an OTP 22 version of erlang you could see if that makes a difference (as a diagnostic tool). – Brett Beatty Jan 15 '21 at 15:35
  • This was a problem due to elixir version . I downgraded to Elixir 1.10.2 (compiled with Erlang/OTP 21) and it worked for me . – satyam Jan 16 '21 at 13:58
  • Have you tried installing `build-essentials` as the error message recommends? – sebisnow Jan 18 '21 at 07:38
  • @sebisnow - yes I had installed it but still this error was there . It is fixed now . What I did was downgraded my elixir version to 1.10.2 (OTP 21) . Thanks for your help . – satyam Jan 19 '21 at 08:04

0 Answers0