Bug 264046 - lang/elixir-devel: doesn't produce self-contained mix releases
Summary: lang/elixir-devel: doesn't produce self-contained mix releases
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Dave Cottlehuber
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-17 16:01 UTC by Pat Maddox
Modified: 2022-06-17 20:31 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (erlang)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pat Maddox 2022-05-17 16:01:43 UTC
Problem: lang/elixir-devel produces mix releases that require an Erlang runtime to be installed. This occurs because it patches the `elixir` startup script to replace ERTS_BIN. It specifies a path that's hard-coded to a file in the lang/erlang-runtime* that was used to build elixir, as described in https://lists.freebsd.org/archives/freebsd-erlang/2022-May/000629.html

---

Goal: Build a mix release, and then run it on a FreeBSD system with no Erlang or Elixir runtime.

From mix release docs: https://hexdocs.pm/mix/Mix.Tasks.Release.html#module-why-releases

> Self-contained. A release does not require the source code to be included in your production artifacts. All of the code is precompiled and packaged. Releases do not even require Erlang or Elixir in your servers, as it includes the Erlang VM and its runtime by default. Furthermore, both Erlang and Elixir standard libraries are stripped to bring only the parts you are actually using.

In other words, you should be able to:

pkg install -y elixir-devel
mix new my_app
cd my_app && mix release
pkg remove -y elixir-devel
pkg autoremove -y
./_build/dev/rel/my_app/bin/my_app start_iex

---

What happens: `exec: /usr/local/lib/erlang24/bin/erl: not found`

What should happen: an IEX console
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-06-17 20:09:23 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=07b93079da18867999e5874fc96afc3b7cf27d15

commit 07b93079da18867999e5874fc96afc3b7cf27d15
Author:     Dave Cottlehuber <dch@FreeBSD.org>
AuthorDate: 2022-06-17 18:46:28 +0000
Commit:     Dave Cottlehuber <dch@FreeBSD.org>
CommitDate: 2022-06-17 20:04:53 +0000

    lang/elixir-devel: remove hard dependency on erlang24

    Since moving from OTP21 as default OTP in lang/erlang, to OTP24,
    we no longer have incompatible bytecode versions between default
    erlang and newer builds. Thus, there is no reason to hard-wire
    the dependency when a simple PATH will work as expected.

    Remove broken SRC as build option.

    PR:             264046
    PR:             257235
    Reported by:    Pat Maddox <pat@patmaddox.com>
    Sponsored by:   SkunkWerks, GmbH

 lang/elixir-devel/Makefile          | 14 +++-----------
 lang/elixir-devel/pkg-message (new) | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 11 deletions(-)
Comment 2 Dave Cottlehuber freebsd_committer freebsd_triage 2022-06-17 20:31:10 UTC
Pat this should take ~ 3-4 days to filter through to package builders and repos, on the latest pkg branch.

Thanks for the quick test case below, much appreciated!