nahoj

nahoj

Erlang dependency compiled with wrong Erlang version

Hello, I’m a newcomer to both Elixir and Erlang and I’ve run into an issue and I hope someone here can help me.

When using mix compile I seem to be getting a compatibility error, that the beam file is compiled for a later version of the runtime system.


16:05:42.441 [error] beam/beam_load.c(184): Error loading module luerl:

This BEAM file was compiled for a later version of the runtime system than the current (Erlang/OTP 25).

To fix this, please re-compile this module with an Erlang/OTP 25 compiler.

(Use of opcode 181; this emulator supports only up to 180.)

A simple cleanup of deps/ and _build/ will recover from the issue, but that isn’t desired.

I’ve isolated it to only show up on Elixir version 1.15.x using below Erlang/OTP


mix --version

Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [jit:ns]

Mix 1.15.7 (compiled with Erlang/OTP 24)

I’ve created a sample repository https://github.com/JohanKarlbergg/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe and put a command in the README reproduce the issue.

I’ve tried to search for similar issues without success.

Most Liked

LostKobrakai

LostKobrakai

While it’s certainly to be preferred that’s not completely correct. You need that for elixir to integrate with OTP 25 features, but using an elixir version compiled with an older otp version should generally work.

Eiji

Eiji

Because this is not considered as an issue. The message is clear enough and as you said there is solution of cleanup which you know without searching. In such case if people know something without searching they don’t create any issue and just your question is not common. :smiley:

Keep in mind that on the forum many users reading your post have no idea how you think like they have no idea why recompiling all dependencies is not desired for you. As you said recompiling all dependencies is of course good idea and people do it by default in almost all cases - at least those I am aware of. However if for some reason you don’t want to compile all dependencies then you can simply recompile just one. :bulb:

mix deps.compile dep_name --force

You need to improve your documentation research skills. What’s may be interesting is mix help task which lists all tasks available and mix help task.name which shows the documentation for said task. I believe that deps.compile is obvious naming, so there is no need to describe what it does. Finally the documentation in mix help deps.compile should be enough clear for you. :+1:

Personally I recommend reading documentation a lot. Of course not to remember everything, but to more or less know where you can find some information and also you may find lots of interesting things that would be helpful for you now or in near future and you were just was not aware of their existence. The common mistake is to not read Erlang documentation assuming that Elixir core is all what you need. For example I have found :erlang.term_to_binary/1 and :erlang.binary_to_term/1 very useful. This is pretty basic and simple to understand thing new developers have completely no idea about. :thinking:

Edit: As @kokolegorille said firstly you need to fix the problem with your Elixir installation. After this you can use mix deps.compile to recompile only those dependencies you want.

kokolegorille

kokolegorille

How did You install Elixir and Erlang? With asdf?

You have an Elixir version for OTP24, but You have OTP25

You need to change the Elixir version to be OTP 25

Latest for now is OTP 26…

Last Post!

nahoj

nahoj

I had this thought also, but I never got further with it and if I compile with DEBUG=1 it suggests that the options is correct, see below.

To emphasize, I’m aware that it might be strange to recompile one dependency, this is only done in order to reproduce the “issue”.

rm -rf _build/ deps && mix deps.get && mix compile --force && DEBUG=1 mix deps.compile luerl --force && mix compile --force

Resolving Hex dependencies...
Resolution completed in 0.013s
Unchanged:
  luerl 1.1.1
* Getting luerl (Hex package)
===> Analyzing applications...
===> Compiling luerl
Compiling 1 file (.ex)
Generated foo app
===> Expanded command sequence to be run: []
===> Running provider: do
===> Expanded command sequence to be run: [app_discovery,{bare,compile}]
===> Running provider: app_discovery
===> Found top-level apps: [luerl]
	using config: [{src_dirs,["src"]},{lib_dirs,["apps/*","lib/*","."]}]
===> Running provider: {bare,compile}
===> Compile (untagged)
===> Running hooks for compile in app luerl (/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl) with configuration:
===> 	{pre_hooks, []}.
===> Running hooks for erlc_compile in app luerl (/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl) with configuration:
===> 	{pre_hooks, []}.
===> Analyzing applications...
===> Compiling luerl
===> compile options: {erl_opts, [debug_info,
                                  {d,'ERLANG_VERSION',"25.3.2.6"},
                                  {d,'HAS_MAPS',true},
                                  {d,'HAS_FULL_KEYS',true},
                                  {d,'NEW_REC_CORE',true},
                                  {d,'NEW_RAND',true},
                                  {d,'NEW_BOOL_GUARD',true},
                                  {d,'HAS_FLOOR',true},
                                  {d,'HAS_CEIL',true},
                                  {d,'NEW_STACKTRACE',true},
                                  {d,'EEP48',true}]}.
===> files to analyze ["/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_sandbox.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_lint.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_env.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_heap.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_math.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_utf8.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_init.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_peep.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_anno.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_os.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/ttdict.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_string.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_old.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/Elixir.Luerl.New.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_vars.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_basic.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_util.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_new.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_os_date.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_locf.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_bit32.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_package.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_io.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_normalise.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_shell.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_parse_exp.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_debug.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_emul.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_scan.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_table.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/ttsets.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_parse.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/Elixir.Luerl.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_app.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_comp_cg.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_sup.erl",
                       "/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl/src/luerl_lib_string_format.erl"]
===> Running hooks for erlc_compile in app luerl (/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl) with configuration:
===> 	{post_hooks, []}.
===> Running hooks for app_compile in app luerl (/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl) with configuration:
===> 	{pre_hooks, []}.
===> Running hooks for app_compile in app luerl (/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl) with configuration:
===> 	{post_hooks, []}.
===> Running hooks for compile in app luerl (/home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/deps/luerl) with configuration:
===> 	{post_hooks, []}.
Compiling 1 file (.ex)

08:09:22.501 [error] beam/beam_load.c(184): Error loading module luerl:
  This BEAM file was compiled for a later version of the runtime system than the current (Erlang/OTP 25).
  To fix this, please re-compile this module with an Erlang/OTP 25 compiler.
  (Use of opcode 181; this emulator supports only up to 180.)



08:09:22.501 [error] Loading of /home/01e3c763592bbc85568a28a81ae6f5f732d8d183f7f533080a0998e7229127fe/_build/dev/lib/luerl/ebin/luerl.beam failed: :badfile

warning: :luerl.dofile/2 is undefined (module :luerl is not available or is yet to be defined)
  lib/foo.ex:3: Foo.bar/0

warning: :luerl.init/0 is undefined (module :luerl is not available or is yet to be defined)
  lib/foo.ex:3: Foo.bar/0

Generated foo app

If I instead only run the command below, which doesn’t recompile luerl it works as expected. It also works if I instead use luerl version 1.1.0 as previously pointed out.

rm -rf _build/ deps && mix deps.get && mix compile --force && mix compile --force

Versions

mix -v
Erlang/OTP 25 [erts-13.2.2.3] [source] [64-bit] [smp:20:20] [ds:20:20:10] [async-threads:1] [jit:ns]

Mix 1.15.7 (compiled with Erlang/OTP 25)

Where Next?

Popular in Questions Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31586 112
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New

We're in Beta

About us Mission Statement