This problem does not exist in ARM containers or VMs, as the same project compiles perfectly in an ARM Alpine Linux container/VM.
It's definitely not plug-and-play for all scenarios. If anyone knows workarounds, let me know.
This problem does not exist in ARM containers or VMs, as the same project compiles perfectly in an ARM Alpine Linux container/VM.
It's definitely not plug-and-play for all scenarios. If anyone knows workarounds, let me know.
Many things are just so much easier with a remote server/workstation somewhere than trying to deal with VM shenanigans.
ARM64 visualised on the otherhand (Linux works great, macos seems good(?), haven't tried Windows) with UTM is pretty great.
Elixir compiles to beam files, like Erlang, right?
I was pretty sure beam files are bytecode and not platform specific?
From the docs [0]:
> Once a release is assembled, it can be packaged and deployed to a target, as long as the target runs on the same operating system (OS) distribution and version as the machine running the mix release command.
The `mix release` command outputs a directory containing your compiled Elixir bytecode files, along with the ERTS (Erlang Runtime System). The ERTS it bundles is only for your host machine's architecture. Another point to remember is that some dependencies use native NIFs, which means they need to be cross-compiled too. Hence it's not as easy as replacing the ERTS folder with one for another architecture in most circumstances.
There's a project that aims to alleviate these issues called Burrito [1], but when I tried it, I had mixed success with it, and decided not to use it for my deployment approach. It looks like Burrito has matured since then, so it would be worth taking a look into if you need to cross-compile.
The gist is, while possible, its significantly harder to get an Elixir release running on another architecture than say is the case for Go.
[0] https://hexdocs.pm/mix/1.16.0/Mix.Tasks.Release.html [1] https://github.com/burrito-elixir/burrito