Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First try with erl 25.0 rc1 #945

Closed
comptekki opened this issue Feb 17, 2022 · 36 comments
Closed

First try with erl 25.0 rc1 #945

comptekki opened this issue Feb 17, 2022 · 36 comments

Comments

@comptekki
Copy link

FYI with erl 25 rc1, I thought I'd try it and when running make to create a release, I get this error:

escript: exception error: undefined function relx:main/1
in function escript:run/2 (escript.erl, line 750)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
make: *** [erlang.mk:7506: relx-rel] Error 127

@essen
Copy link
Member

essen commented Feb 17, 2022

I will have to rebuild a relx binary probably since it dropped support for 20 beam files.

@crownedgrouse
Copy link
Contributor

Having same issue with 25-rc2 . Any update on this issue ?

escript: exception error: undefined function relx:main/1
  in function  escript:run/2 (escript.erl, line 750)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_em/1 
  in call from init:do_boot/3 
erlang.mk:7505: recipe for target 'relx-rel' failed

@essen
Copy link
Member

essen commented Apr 10, 2022

Forgot about it. Will do that on Monday.

@essen
Copy link
Member

essen commented Apr 12, 2022

I'm afraid it looks a bit more difficult than just recompiling against 22+. The release generated by Relx no longer contains a RELEASES file which is necessary for some features to work (such as release upgrades). I can create an empty RELEASES file and this will let most use of releases work but NOT release upgrades. For that upgrading Relx will certainly be necessary, and that implies switching from escript to using it as a library.

So for the time being I will push the update that makes it work in all cases except release upgrades, but then I will have to find time to do a proper move to Relx 4. This is going to be a breaking change (although we can support both modes for the time being).

@essen
Copy link
Member

essen commented Apr 12, 2022

I have pushed the temporary commit.

@comptekki
Copy link
Author

I added the updated erlang.mk, but when I gmake on freebsd is says:

touch: _rel/projname_release/releases/RELEASES: No such file or directory
gmake: *** [erlang.mk:7507: relx-rel] Error 1

but if I do:

mkdir _rel/projname_release/releases

touch _rel/projname_release/releases/RELEASES

then run gmake again, it works.

I'm not sure why there is a projname_release. I thank it should just be projname in the path.

@essen
Copy link
Member

essen commented Apr 18, 2022

I probably used the wrong variable. I'll take a look when I can.

@essen
Copy link
Member

essen commented Apr 26, 2022

Hm I will change it to use $(PROJECT) but this is not the right fix. I have to upgrade Relx soon.

@essen
Copy link
Member

essen commented Apr 26, 2022

Actually that's probably because you have a relx.config that changes the default release name. So it's a bit more complicated. I will just have to upgrade Relx.

@crownedgrouse
Copy link
Contributor

Still in rc2, no hurry.
But this must be fixed for 25 announcement.

@essen
Copy link
Member

essen commented Apr 26, 2022

Well rc3 is out so now is the time really.

@essen
Copy link
Member

essen commented Apr 26, 2022

I will have to remove a few things including RELX_OPTS, at least initially. It would be helpful if I could know which relx.config file and RELX_* configuration everyone is using.

@essen
Copy link
Member

essen commented Apr 26, 2022

I am making it similar to proper, which means relx will need to be added to REL_DEPS (or other relevant DEPS) in order to run.

@essen
Copy link
Member

essen commented Apr 27, 2022

Another heads up: these options will need to be set explicitly since it seems like the defaults have changed:

{dev_mode, false}.
{include_erts, true}.

@essen
Copy link
Member

essen commented Apr 27, 2022

Please try the relx4 branch: https://github.com/ninenines/erlang.mk/tree/relx4

Note that it currently requires a custom relx if you are using simple integers for release versions. Also make note of the earlier comments.

@essen
Copy link
Member

essen commented Apr 27, 2022

I have opened erlware/relx#911 to get the fix in the main Relx repository.

@comptekki
Copy link
Author

This is what I use for relx.config:

{release, {esysman, "1.20"}, [esysman]}.
{extended_start_script, true}.
{vm_args, "./config/vm.args"}.

@essen
Copy link
Member

essen commented Apr 28, 2022

Tests are now green on the branch (no changes to release code since yesterday) so it's just a matter of feedback or OTP 25 getting released. I will try on my own projects as well, I got a bunch in Cowboy and Ranch that can exercise these changes.

@essen
Copy link
Member

essen commented Apr 28, 2022

I will also need to reenable the Windows VM to test on Windows at some point.

@essen
Copy link
Member

essen commented Apr 28, 2022

The Cowboy/Ranch tests that use releases all pass with minor updates. Other than start->daemon, I also encountered the fact that the eval command now expects the final dot.

@essen
Copy link
Member

essen commented Apr 29, 2022

Windows now works but it required another relx patch. The relevant PR is erlware/relx#914

@essen
Copy link
Member

essen commented Apr 29, 2022

Relevant problem if using OTP-25.0-rc2: erlang/otp#5826

@crownedgrouse
Copy link
Contributor

Works for me now, thanks

@comptekki
Copy link
Author

In aa0053c is there a reason you did this:

$(verbose) touch $(RELX_OUTPUT_DIR)/$(PROJECT)_release/releases/RELEASES

and not this:

$(verbose) touch $(RELX_OUTPUT_DIR)/$(PROJECT)/releases/RELEASES

When I take out the _releases, it works fine for me.

@essen
Copy link
Member

essen commented May 11, 2022

Neither are correct, the release name is provided in relx.config and is not dependent on $(PROJECT). The one with _release is simply the default.

@comptekki
Copy link
Author

That line is on line 49 here:

https://github.com/ninenines/erlang.mk/blob/master/plugins/relx.mk

$(PROJECT)_release

should jsut be

$(PROJECT)

@essen
Copy link
Member

essen commented May 13, 2022

It is correct for the default as I've said, see https://github.com/ninenines/erlang.mk/blob/master/plugins/bootstrap.mk#L95

The real fix is in the relx4 branch. Please try it and report feedback on that instead, as the touch workaround will be removed when that branch is merged.

@essen
Copy link
Member

essen commented May 19, 2022

I will merge the relx changes today. I will also investigate a potential issue with xref.

@essen
Copy link
Member

essen commented May 20, 2022

Merged! Thanks. I will investigate xref now.

@essen essen closed this as completed May 20, 2022
@comptekki
Copy link
Author

Just an FYI: I just installed erlang 25, git cloned your erlang.mk project and ran make on it and put the erlang.mk in my project and all works with no error. Thanks!

@comptekki
Copy link
Author

Hmm. Maybe I'll need to redo how my project is set up. I noticed now that "make distclean" does not remove _rel nor does "make" create a new _rel folder. Any tips what direction I need to go for this? Thanks

@comptekki
Copy link
Author

I probably just need to implement what you have in your comments about the braking changes.

@essen
Copy link
Member

essen commented May 20, 2022

Yes you need to add REL_DEPS = relx to your Makefile or it won't do anything.

@comptekki
Copy link
Author

This is what my make file looks like:

PROJECT = esysman

DEPS = cowboy epgsql
REL_DEPS = relx
dep_cowboy = git https://github.com/ninenines/cowboy 2.9.0
dep_epgsql = git https://github.com/wg/epgsql.git master
dep_relx = git https://github.com/erlware/relx master

include erlang.mk
include extra.mk

I get this now when running make:
...
DEPEND relx.d
ERLC relx.erl rlx_app_info.erl rlx_assemble.erl rlx_config.erl rlx_file_utils.erl rlx_log.erl rlx_overlay.erl rlx_release.erl rlx_relup.erl rlx_resolve.erl rlx_state.erl rlx_string.erl rlx_tar.erl rlx_util.erl
APP relx.app.src
make[1]: Leaving directory '/path/esysman/deps/relx'
erl +A1 -noinput -boot no_dot_erlang -pa ebin/ -pz /path/esysman/.erlang.mk/rebar/ebin -eval " {ok, Config} = file:consult("/path/esysman/relx.config"), {release, {Name, Vsn0}, } = lists:keyfind(release, 1, Config), Vsn = case Vsn0 of {cmd, Cmd} -> os:cmd(Cmd); semver -> ""; {semver, } -> ""; VsnStr -> Vsn0 end, {ok, } = relx:build_release(#{name => Name, vsn => Vsn}, Config), halt(0)." -- erlang.mk
Solving Release esysman-1.20{"init terminating in do_boot",{{error,{rlx_resolve,{app_not_found,esysman,undefined}}},[{rlx_resolve,subset,7,[{file,"src/rlx_resolve.erl"},{line,72}]},{rlx_resolve,'-fold_apps/7-fun-0-',7,[{file,"src/rlx_resolve.erl"},{line,99}]},{lists,foldl,3,[{file,"lists.erl"},{line,1350}]},{rlx_resolve,subset,5,[{file,"src/rlx_resolve.erl"},{line,54}]},{rlx_resolve,solve_release,2,[{file,"src/rlx_resolve.erl"},{line,48}]},{relx,build_release
,3,[{file,"src/relx.erl"},{line,170}]},{relx,build_release,3,[{file,"src/relx.erl"},{line,87}]},{erl_eval,do_apply,7,[{file,"erl_eval.erl"},{line,744}]}]}}
init terminating in do_boot ({{error,{rlx_resolve,{app_not_found,esysman,undefined}}},[{rlx_resolve,subset,7,[{
},{
}]},{rlx_resolve,-fold_apps/7-fun-0-,7,[{},{}]},{lists,foldl,3,[{},{}]},{rlx_resolve,subset,5,[{},{}]},{rlx_resolve,solve_release,2,[{},{}]},{relx,build_release_,3,[{},{}]},{relx,build_release,3,[{},{}]},{erl_eval,do_apply,7,[{},{}]}]})

Crash dump is being written to: erl_crash.dump...done
make: *** [erlang.mk:7537: relx-rel] Error 1

@essen
Copy link
Member

essen commented May 21, 2022

Should have said BUILD_DEPS by the way. You probably don't want it included in the release.

Also please remove the dep_relx line and use the one defined by erlang.mk for now as it contains a fix that upstream relx hasn't merged yet. You might need to make distclean as well. If that fails please provide a test repository that I can use to reproduce.

@essen
Copy link
Member

essen commented May 27, 2022

Note that relx will be added automatically when creating a new project as of a few days ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants