Unable to build Erlang 26 on Aarch64 macOS Ventura 13.6

Thought I’d write my problem here, so it can be found with a web search later. Not expecting anyone to have an answer to it, but great if you do. :slight_smile:

I use an M1 Pro MBP in Aarch64. I’ve had no trouble with Erlang 25, but I cannot install Erlang 26.1.1 with asdf due to:

gmake[4]: Entering directory '/Users/nicd/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_src_26.1.1/erts/emulator'
gmake[4]: *** No rule to make target 'x86/x86assembler.h', needed by 'obj/aarch64-apple-darwin22.6.0/opt/jit/beam_asm_global.o'.  Stop.
gmake[4]: *** Waiting for unfinished jobs....
 CC     obj/aarch64-apple-darwin22.6.0/opt/jit/asm_load.o
 CC     obj/aarch64-apple-darwin22.6.0/opt/jit/preload.o
 CC     obj/aarch64-apple-darwin22.6.0/opt/jit/erl_main.o
 CC     obj/aarch64-apple-darwin22.6.0/opt/jit/erl_process.o
 CXX    aarch64-apple-darwin22.6.0/opt/jit/asmjit/asmjit.hpp.gch
In file included from aarch64-apple-darwin22.6.0/opt/jit/asmjit/asmjit.hpp:30:
aarch64-apple-darwin22.6.0/opt/jit/asmjit/./x86.h:84:10: fatal error: 'x86/x86assembler.h' file not found
#include "x86/x86assembler.h"
1 error generated.
gmake[4]: *** [aarch64-apple-darwin22.6.0/Makefile:948: aarch64-apple-darwin22.6.0/opt/jit/asmjit/asmjit.hpp.gch] Error 1
gmake[4]: Leaving directory '/Users/nicd/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_src_26.1.1/erts/emulator'
gmake[3]: *** [/Users/nicd/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_src_26.1.1/make/run_make.mk:35: opt] Error 2
gmake[3]: Leaving directory '/Users/nicd/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_src_26.1.1/erts/emulator'
gmake[2]: *** [Makefile:45: opt] Error 2
gmake[2]: Leaving directory '/Users/nicd/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_src_26.1.1/erts'
gmake[1]: *** [Makefile:60: jit] Error 2
gmake[1]: Leaving directory '/Users/nicd/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.1/otp_src_26.1.1/erts'
gmake: *** [Makefile:503: emulator] Error 2

Couldn’t find any hits on this online. Let me know if you have anything you’d like me to try. In the meantime I’ll try building other 26.x versions.

I have just recently updated the XCode command line tools, I wonder if that has an effect.

1 Like

I can not replicate this on my m2 FWIW. I do have something for you try, make sure you don’t have any lingering env variables that you’re not thinking of. I have had an issue (for which I need file an issue for, thanks for the reminder) where by I have CPPFLAGS, CC, and LDFLAGS set to deal with a dependency (which has another dependency, etc.), if I have these set (and I’m quite sure it’s particular to what I’m setting) the wrong arch gets picked up in some places. iirc. (I have not tested this recently also).

That’s a total shot in the dark, but figured it’s worth calling out.

1 Like

I don’t have any of these, but I don’t know what asdf/kerl do internally.

I also noticed that I can’t build any Erlang version. So maybe I should be reporting this to the asdf-erlang issue tracker.

1 Like

Perhaps. I tried to replicate on another machine, but could not, same ventura version, etc.
I really want to replicate this one :slight_smile: I wonder if this is an autoconf and friends problem. Have you checked to see if your core utils are up to date?

For posterity an issue was open related to the problem I described above (environment variables mucking up the build) here

I didn’t report this to asdf yet as I’ve had other things to do. Meanwhile I updated to macOS Sonoma, and now I can’t run Erlang 25 due to the bus error (JIT is broken), and I can’t build Erlang 26 due to this asmjit error. So I guess I should report it. :smiley:

EDIT: Here’s the issue now: fatal error: 'x86/x86assembler.h' file not found (macOS Ventura / Sonoma) · Issue #292 · asdf-vm/asdf-erlang · GitHub

1 Like

The bus error was fixed in as FYI


@Nicd curious, did you try to use just use kerl to perform a build?

This does not help me as I can’t build :smiley:

I haven’t tried just kerl yet, but I guess I should.

The same thing happens with kerl so I’ve moved the bug report to fatal error: 'x86/x86assembler.h' file not found (macOS Ventura / Sonoma) · Issue #494 · kerl/kerl · GitHub

I suppose what would help kerl maintainers is to show that this problem doesn’t happen if you just do a plain ole ./configure && make after downloading the source tarball from github.

Ok, as I just commented on the issue, I’ve fixed it and it was due to my environment:

The x86 had bugged me from the start because I knew I was running in ARM mode. Turns out I had installed a second Homebrew (Intel version) according to these instructions on SO because I needed it for some QMK keyboard firmware related package. Even though my PATH was pointing to the ARM Homebrew, apparently something in the build was picking up the x86-64 version and making a mix’n’match build that understandably blew up.

After I removed the second Homebrew, my builds started passing again. :slight_smile: Hope this is findable as a search result for anyone else who happens to do such silly things.


asdf (or rtx) uses kerl under the hood and mainly only configures it to build and install to locations specific to those tools.

1 Like