iautom8things

iautom8things

[arm64+otp 25+qemu] `mix local.hex --force` hangs

We haven’t been able to start using Erlang 25, yet, because I’ve been unable to get our base images built with it. Half of our developers use Macs with the new arm processors, so we’ve switched to a process that builds our images with multi arch support.

I’ve created a dumbed down process as an example of how we build it using Github Actions, here:

You can see here where this problem happens with all supported versions (from hexpm/elixir - Docker Image) when using Erlang 25:

https://github.com/iautom8things/test-arm64-qemu-issue/runs/7104382049?check_suite_focus=true

I stopped it after 12.5 minutes.

On an ubuntu machine I have I can also duplicate this hanging:

docker buildx build --platform linux/arm64,linux/amd64 -t test-arm64-qemu-issue --build-arg ELIXIR_VERSION=1.13.4 --build-arg ERLANG_VERSION=25.0 --build-arg ALPINE_VERSION=3.16.0 .

Has anyone had any luck with this?

Most Liked

garazdawi

garazdawi

Erlang Core Team

I don’t know if this is your problem, but because of bugs in qemu when emulating arm64 the JIT does not work there, so you need to run the arm64 docker images on a native arm64 machine, or disable the JIT (which is done when compiling Erlang).

It should manifest as a segfault and not as a hang, but maybe something is masking the segfault.

Edit: You can find some more information here: OTP 25.0-rc3 (release Candidate 3) is released - #25 by jhogberg - Erlang News - Erlang Programming Language Forum - Erlang Forums

mmyers

mmyers

The QEMU bug for the OTP 25 JIT compiler failing was supposedly fixed in qemu 8.1. So maybe the problem we’re seeing with docker cross-builds is a different problem?

I’m running a docker cross-build targeting linux/arm64 from a linux/amd64 host using qemu v8.1.2 and I see a similar problem as the OP, with OTP 24 it builds fine, but with OTP 25 or 26 it will hang forever at a RUN mix deps.get step. Note: For me mix local.rebar and mix local.hex steps complete successfully

Are the only solutions still what @garazdawi recommends? 1) build arm64 images on a native arm64 host, or 2) use an Erlang build with the JIT disabled?

iautom8things

iautom8things

Not quite, we’ve just stuck with 24 for the time being.

Nicoo

Nicoo

I had this problem on my m1. I have a solution that is not ideal but it works, if it can help someone:

  • I have activated Rosetta
  • I have added export DOCKER_DEFAULT_PLATFORM=linux/amd64 in my .zshrc file (.env file should works also).
  • For the rare images where the image doesn’t work well in emulated amd64, I use the arm64 platform. In order not to bother my colleagues by placing my arm64 in the Dockerfile, there is the Docker variable $BUILDPLATFORM

Example:

FROM --platform=$BUILDPLATFORM hexpm/elixir:1.14.3-erlang-25.2.2-ubuntu-jammy-20221130

This is the only image where I need to do that. So all my other images (Postgres, Redis, etc) stay in amd64.
I hope this trick will not be required for too long.

georgeguimaraes

georgeguimaraes

I was having trouble building a amd64 docker image on my MacBook Pro (arm64).

I was about to give up until I tried https://orbstack.dev/ instead of Docker Desktop.

Now it’s working. Maybe orb is using a newer qemu.

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New

We're in Beta

About us Mission Statement