ignatov / intellij-erlang

Erlang IDE
https://www.jetbrains.com/help/idea/2018.2/getting-started-with-erlang.html
Other
735 stars 120 forks source link

Eunit run-config fails after upgrading to Erlang 25 #980

Closed pobengtsson closed 2 years ago

pobengtsson commented 2 years ago

After I upgraded to Erlang 25 running Rebar Eunit run-configurations fail with the following output:

=ERROR REPORT==== 3-Jun-2022::19:34:03.051778 ===
Loading of /private/var/folders/1l/1yh2fkzs3csfpbqhv7fpdx240000gn/T/eunit_teamcity/eunit_teamcity.beam failed: badfile

=ERROR REPORT==== 3-Jun-2022::19:34:03.051773 ===
beam/beam_load.c(148): Error loading module eunit_teamcity:
  please re-compile this module with an Erlang/OTP 25 compiler

It seems like the Erlang 25 compiler does not support older format .beam-files. Running tests in the terminal with rebar3 eunit works fine.

How can I help in fixing this?

artman41 commented 2 years ago

is this a project you've been developing since OTP 21?

as per the OTP 25 Release notes:

To enable more optimizations, BEAM files compiled with OTP 21 and earlier cannot be loaded in OTP 25.

I'd recommend removing all the .beam files and trying again

jballin82 commented 2 years ago

I'm getting the same problem. Which beam files should be deleted from where? If I clear out the eunit_teamcity folder from that location (in my case: /private/var/folders/8b/_156xrn93cx_gkb8slzq9ldw0000gn/T) IntelliJ (I suppose?) creates eunit_teamcity1 on the next attempt, and so on.

artman41 commented 2 years ago

I'm getting the same problem. Which beam files should be deleted from where? If I clear out the eunit_teamcity folder from that location (in my case: /private/var/folders/8b/_156xrn93cx_gkb8slzq9ldw0000gn/T) IntelliJ (I suppose?) creates eunit_teamcity1 on the next attempt, and so on.

Ah, I'm assuming then that this isn't some personal project you're trying to run eunits against.

Are the source .erl files included with eunit_teamcity or do they only include the .beam files? If there's no .erl files, I'd hazard a guess that you may be out of luck - though you could try to load the directly manually and see if the files will load in to the VM erl -pa <dir>.

If the source files are included, just compile them with your favourite compiler erlang.mk / rebar3 etc. and move the .beam files to where they were before.

ignatov commented 2 years ago

Hi! We have a binary file compiled in resources/eunit/eunit_teamcity.beam and we're using it while running tests. Should I rebuild it?

ignatov commented 2 years ago

Most probably, 25 is not the best version to compile it with, I'm afraid that it's not going to be possible to run that beam on older versions of VM.

artman41 commented 2 years ago

Most probably, 25 is not the best version to compile it with, I'm afraid that it's not going to be possible to run that beam on older versions of VM.

Are there any dependencies of the eunit_teamcity.erl?

If there isn't, the plugin could attempt to run erlc on it to compile it itself?

Just throwing ideas out there :)

pobengtsson commented 2 years ago

@ignatov for a quick fix, compiling with version 22, ought to do it with least impact to compatibility.

@artman41's idea of compiling the file using whatever erlc is used for the project, seems nice.

ignatov commented 2 years ago

okay, I'll try to install elrc 22 and compile the file with it

ignatov commented 2 years ago

I hope that will fix the issue

ignatov commented 2 years ago

@pobengtsson Please try that plugin and it works I'll publish the update intellij-erlang-0.11.1142.zip

pobengtsson commented 2 years ago

@ignatov I updated to the 0.11.1142 plugin by clicking upgrade in Intellij, and my unit tests runs like a charm again!

Many Thanks!