Is creating the Elixir release on arm Macbook M1 a problem when uploading that to an intel architecture Ubuntu server?

I would like to buy Macbook Air M1. However, it is an ARM computer and not an intel computer like my Linode server which is intel architecture.

Will I have a problem when creating a final release via

MIX_ENV=prod mix release

?

Also, does Elixir and Phoenix run OK on the M1 Mac? Does any of you use M1 Mac, how is your experience?

1 Like

Hi there!

I have a MacBook Air M1 and it is a fantastic machine. I encountered zero problems working with Elixir.

However, your release will not work. See mix release — Mix v1.12.3 for more info.

You can use Docker to do a cross-compilation. I build my releases with GitHub Actions that provide Ubuntu runners as it’s more a convenient way for me.

Hope it helps a bit.

2 Likes

Hmm, that’s super bad. ;(

Releases were always bound to the architecture they’re built on. Even if you used mac os on an intel mac you couldn’t run releases built on it on an ubuntu host.

7 Likes

And what about uploading the code to the Linode server and make a build there? How slow will the compilation process be? A minute or two? Will it slow down the server that has running website already in Phoenix? Or I can use blue green deployment with two servers if that will be a problem.

Isn’t there some cross-compilation tool by the Elixir team to mitigate this M1 Mac issue? Have they mentioned that they are working on it?

I don’t want to use Docker. I hate it. Also I don’t host stuff on Github or gitlab, I version stuff only locally for security and legal issues. Any idea what can I do in such case? Upload the project files to the Linode server that has Erlang VM and Elixir installed and make a release build there?

No.

You do not need Docker, you can use any other setup that will:

  • Provide compiled ERTS for the target platform (unless you compile your release without ERTS, but then you need to ensure that on the target host there is ERTS in exactly the same version you compiled your project with, also this will not allow you to do hot upgrades)
  • If you have NIFs: provide compiler that will build NIFs for target platform (you can try Zig for example to do so)
1 Like

You could use any other virtualization tooling as well.

2 Likes

Depends on what you want to compile. I compile the Erlang, Elixir, Emacs and my applications on my 1GB 1vCPU VPS regularly. It is doable.

Just to be clear, you can just build your application in Docker, extract it from the build container as a compressed archive, upload it to your host and unpack. You don’t have to run it as a Docker container on your host

4 Likes

Yeah, exactly this, this is what we do at $job.

2 Likes

You run compilation under emulation for work? I’d imagine there is no shortage of idle PCs lying around in a typical work environment for the build jobs.

Probably, but the company isn’t big, and I was on a much too tight a deadline to fiddle with my 4 idle laptops at home… Oh, and the 24/7 server.

It would be a very interesting project to try and have build infrastructure at home now that things have settled a bit.

Part of my duties is to build an Elixir release (including with Rust libraries) inside Docker and deploy it to a bunch of servers, yes, but that’s not a job description. Just one of the items in my job description as a senior dev.

1 Like

I use a spare desktop pc for that. It is on 24/7 and accessible from anywhere via a reverse SSH tunnel. Current bottleneck is the uptime of home broadband, which is sadly only about 95%.

1 Like

That’s why I have two ISP connections at home. :003: