Upgraded to 1.6, strange error from mix compile

Hello,

I recently upgraded to elixir 1.6 (via homebrew) and now I am getting the following error when I try to compile any code (this example is from PragDave’s e4p repo, but I get the same error on any code I try):

$ mix
==> dictionary
Compiling 3 files (.ex)
Generated dictionary app
==> hangman
Compiling 4 files (.ex)
warning: trailing commas are not allowed inside function/macro call arguments
  lib/hangman/game.ex:7

Generated hangman app
** (EXIT from #PID<0.73.0>) an exception was raised:
    ** (ArgumentError) argument error
        :erlang.byte_size(:missing_chunk)
        (stdlib) beam_lib.erl:438: :beam_lib.build_chunks/1
        (stdlib) beam_lib.erl:440: :beam_lib.build_chunks/1
        (stdlib) beam_lib.erl:319: :beam_lib.build_module/1
        (elixir) src/elixir_erl.erl:15: :elixir_erl.add_beam_chunks/2
        (elixir) lib/protocol.ex:503: Protocol.compile/3
        (mix) lib/mix/tasks/compile.protocols.ex:146: Mix.Tasks.Compile.Protocols.consolidate/4
        (elixir) lib/task/supervised.ex:88: Task.Supervised.do_apply/2

I have tried deleting the _build directory, un- and re-installing elixir (through homebrew). Does anyone have any suggestions on what might be wrong, or how I can start troubleshooting this? Will I have better luck if I install erlang and elixir from their precompiled packages?

Thanks!

Maybe remove the last comma of this game file.

  defstruct(
    turns_left: 7,
    game_state: :initializing,
    letters:    [],
    used:       MapSet.new(),  #<---
)

You can have a look at this topic

I also much prefer to install Erlang/Elixir with asdf.

1 Like

What’s your Erlang version?

(context: if you got a pre-built Elixir from homebrew, and they built it against Erlang 20, and you’re running 19 - that could cause a missing chunk error like the above)

1 Like

@kokolegorille Thanks for pointing that out! Unfortunately cleaning up the warning didn’t solve the problem.

Here’s what I’ve got installed:

$ elixir -v
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Elixir 1.6.0 (compiled with OTP 20)

$ erl
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

brew info erlang says that erlang is at 20.2.2. I tried blowing away my entire homebrew installation and re-installing just erlang and elixir, but I get the same versions as above, and the same issue.

Interestingly, upgrading to 1.6 was successful on my work machine. Both erlang and elixir there are also installed via homebrew (same versions), but that machine is still on OS X El Capitan. (The machine that is giving me fits is on macOS High Sierra.)

Is there any way to start troubleshooting this? Some light searching hasn’t come up with anyone else with the same problem, and I don’t know enough about erlang or elixir to even know where to start.

Thanks!

I have almost the same setting., but mine was installed by asdf.

$ elixir -v
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

Elixir 1.6.0 (compiled with OTP 20)
$ erl
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

I cloned the repo and compile, but have no luck either

$ iex -S mix
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]

==> hangman
Compiling 1 file (.ex)
warning: variable "game" is unused
  lib/hangman/server.ex:19

Interactive Elixir (1.6.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> TextClient.start
{:tally}
** (exit) exited in: GenServer.call(#PID<0.145.0>, {:tally}, 5000)
    ** (EXIT) bad return value: {:tally}
    (elixir) lib/gen_server.ex:831: GenServer.call/3 
    (text_client) lib/text_client/interact.ex:14: TextClient.Interact.setup_state/1
    (text_client) lib/text_client/interact.ex:7: TextClient.Interact.start/0

If You follow the course, I would advise You to type the code, instead of cloning the repo.

If You don’t follow the lectures, I would advise You to try with some simple code, just to check.

I was finally able to get it to work by installing Erlang 19.3 and Elixir 1.6 from their pre-compiled packages. @dom’s theory about a version mismatch seems to have been correct even though it appeared that homebrew was installing the correct versions.

I’ve had this issue too (erlang 20.2.2 and elixir 1.6.0 via brew), only in one specific project, but not others.

Removed _build and deps, and then it worked again.

That’s interesting, removing _build didn’t do anything for me. Even mix compile on a brand-new project failed.

Same problem here. Im getting this error even on a new pure elixir project without any modifications at all.

###System info:

  • Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false]
  • Elixir (1.6.0)
  • ArchLinux Linux hostname1 4.14.13-1-ARCH #1 SMP PREEMPT Wed Jan 10 11:14:50 UTC 2018 x86_64 GNU/Linux

Procedure to re-produce:

  1. mix new test_prj
  2. cd test_prj
  3. mix compile
2 Likes

Downgrading elixir to 1.5.3 fixed the problem for me.

@josevalim there seems to be a problem with elixir 1.6.0 on some machines!
I can run more tests if you like.

It will be fixed in the upcoming v1.6.1 release.

5 Likes

Thanks :heart_eyes:

v1.6.1 is out!

9 Likes