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

compiler application needed for install_upgrade.escript? #940

Closed
benbro opened this issue Aug 25, 2024 · 2 comments · Fixed by #941
Closed

compiler application needed for install_upgrade.escript? #940

benbro opened this issue Aug 25, 2024 · 2 comments · Fixed by #941

Comments

@benbro
Copy link

benbro commented Aug 25, 2024

Is there a way to make install_upgrade.escript work without adding the compiler application (3MB) to the release?
Might be related: #589

When I'm calling bin/mytest upgrade 0.2.0 on a target server I'm getting an error:

escript: Internal error: undef
[{compile,forms,
  [[{attribute,{3,1},file,{"mytest/bin/install_upgrade.escript",3}},
  ...

It works after I add the compiler application to the release in rebar.config:

{relx, [
    {release, { mytest, "0.2.0" },
        [mytest,
         sasl,
         compiler]},
    {dev_mode, false},
    {include_erts, true},
    {include_src, false},
    {sys_config, "./config/sys.config"},
    {vm_args, "./config/vm.args"}
]}
@ferd
Copy link
Collaborator

ferd commented Aug 26, 2024

Ah I'm surprised by it, but it turns out that over time the Erlang distribution changed how escripts work. It used to be we needed to pass -mode(compile). for the escript to be compiled, but this changed and now we need to pass in -mode(interpret). starting with OTP-27. We'll need to modify all escripts in https://github.com/erlware/relx/tree/main/priv/templates to have -mode(interpret). in order to be safe on newer Erlang versions.

@ferd
Copy link
Collaborator

ferd commented Aug 26, 2024

#941 should fix it

@ferd ferd closed this as completed in #941 Aug 27, 2024
@ferd ferd closed this as completed in ba96e6d Aug 27, 2024
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

Successfully merging a pull request may close this issue.

2 participants