asdf-erlang icon indicating copy to clipboard operation
asdf-erlang copied to clipboard

Unable to install Erlang/OTP 27.1 and 26.2.5.3 on Apple Silicon macOS and Xcode 16.0

Open zacky1972 opened this issue 1 year ago β€’ 15 comments

Hi,

I tried to build Erlang/OTP 27.1 on Apple Silicon macOS Sonoma and Sequoia, but got the following error:

In file included from sys/unix/erl_unix_sys.h:65:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:525:10: fatal error: cannot open file 'aarch64-apple-darwin24.0.0/opt/jit/_ctermid.h': Too many open files
  525 | #include <_ctermid.h>
      |          ^
1 error generated.
make[4]: *** [obj/aarch64-apple-darwin24.0.0/opt/jit/beam_asm_module.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

zacky1972 avatar Sep 18 '24 18:09 zacky1972

The new Xcode (16.0) on Apple Silicon may be the culprit, because building Erlang/OTP 26.2.5.3 on Apple Silicon Sequoia also failed.

zacky1972 avatar Sep 18 '24 18:09 zacky1972

similar issue here, but with different error:

In file included from aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/globals.h:9:
aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/../core/api-config.h:45:10: fatal error: 'initializer_list' file not found
   45 | #include <initializer_list>
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.
make[4]: *** [aarch64-apple-darwin24.0.0/opt/jit/asmjit/asmjit.hpp.gch] Error 1
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

The header file on my system is found in the llvm & gcc flavors:

 find /opt -name initializer_list\*
/opt/homebrew/Cellar/llvm/18.1.8/include/c++/v1/initializer_list
/opt/homebrew/Cellar/llvm/18.1.8/share/libc++/v1/std/initializer_list.inc
/opt/homebrew/Cellar/gcc/14.2.0/include/c++/14/initializer_list
/opt/homebrew/Cellar/gcc/13.2.0/include/c++/13/initializer_list

Also fails for otp-26 builds, complaining about a different header file

In file included from aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/globals.h:9:
aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/../core/api-config.h:42:10: fatal error: 'iterator' file not found
   42 | #include <iterator>
        |          ^~~~~~~~~~
1 error generated.
make[4]: *** [aarch64-apple-darwin24.0.0/opt/jit/asmjit/asmjit.hpp.gch] Error 1
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

I assume the Xcode tool update is the culprit as well.

mlooney avatar Sep 18 '24 18:09 mlooney

fatal error: cannot open file 'aarch64-apple-darwin24.0.0/opt/jit/_ctermid.h': Too many open files

@zacky1972 this seems to be your issue, which is different than mine. make sure your system isn't running out of file handles (you may need to tweak your kernel, or shut down some processes etc)

mlooney avatar Sep 19 '24 15:09 mlooney

hello folks, anyone managed to overcome this?

BlueHotDog avatar Sep 22 '24 08:09 BlueHotDog

Hitting similar error:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/unistd.h:525:10: fatal error: cannot open file 'aarch64-apple-darwin24.0.0/opt/jit/_ctermid.h': Too many open files
  525 | #include <_ctermid.h>
      |          ^
1 error generated.
make[4]: *** [obj/aarch64-apple-darwin24.0.0/opt/jit/beam_asm_module.o] Error 1

Environment info:

$ which gcc
/usr/bin/gcc

$ gcc --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ clang --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

chulkilee avatar Sep 23 '24 06:09 chulkilee

@mlooney No, its' not my issue, because I tried to build it just after rebooting my Mac, but I couldn't build it with similar messages:

% asdf install erlang latest
asdf_27.1 is not a kerl-managed Erlang/OTP installation
The asdf_27.1 build has been deleted
Extracting source code
Building Erlang/OTP 27.1 (asdf_27.1), please wait...
APPLICATIONS DISABLED (See: /Users/zacky/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1/otp_build_27.1.log)
 * odbc           : ODBC library - link check failed

Build failed.
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/unistd.h:525:10: fatal error: cannot open file 'aarch64-apple-darwin24.0.0/opt/jit/_ctermid.h': Too many open files
  525 | #include <_ctermid.h>
      |          ^
1 error generated.
make[4]: *** [obj/aarch64-apple-darwin24.0.0/opt/jit/beam_asm_module.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

Please see /Users/zacky/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1/otp_build_27.1.log for full details.
Removing all artifacts except the logfile
(Use KERL_AUTOCLEAN=0 to keep build on failure, if desired)
Cleaning up compilation products for asdf_27.1
Cleaned up compilation products for asdf_27.1 under /Users/zacky/.asdf/plugins/erlang/kerl-home/builds

zacky1972 avatar Sep 23 '24 08:09 zacky1972

Hello, I encountered the same problem. I resolved it by doing these steps.

I uninstalled xcode by following these commands: https://mac.install.guide/commandlinetools/6

After that I ran these commands cleaning up my environment. asdf uninstall erlang <version> asdf uninstall elixir <version> rm -rf .asdf/ brew uninstall asdf

Then, I tried to re-install asdf with homebrew but it requires me to reinstall xcode so I reinstall xcode again by running this command: xcode-select --install

After installation I installed asdf with homebrew: brew install asdf

Installed plugin Elixir: asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git Installed plugin Erlang: asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git

Installed erlang: asdf install erlang 27.1 Installed elixir: asdf install elixir 1.17.3-otp-27 set global erlang: asdf global erlang 1.17.3-otp-27 set global elixir : asdf global elixir 1.17.3-otp-27

Then I go to my project directory and run mix assets.deploy and mix phx.server and it worked. Hope this helps.

obieewan avatar Sep 23 '24 09:09 obieewan

I encountered the same issue on Apple Silicon with Xcode 16.0. A temporary fix that worked for me was adjusting the ulimit to increase the number of allowed open files. Here’s what I did:

  1. Open terminal.
  2. Run ulimit -n 65536 to increase the limit.
  3. Retry the installation.

This is a temporary solution, and if needed, the change can be made permanent by modifying system configuration files.

Hope this helps!

haavars avatar Sep 23 '24 09:09 haavars

@haavars Thanks! I did install according to your approach!!!

zacky1972 avatar Sep 23 '24 11:09 zacky1972

I'm getting a different error on Apple Silicon with Xcode 16.0, any ideas?

Extracting source code
Building Erlang/OTP 27.1 (asdf_27.1), please wait...
APPLICATIONS DISABLED (See: /Users/redacted/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1/otp_build_27.1.log)
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - link check failed

APPLICATIONS INFORMATION (See: /Users/redacted/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1/otp_build_27.1.log)
 * wx             : wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
 * wxWidgets was not compiled with --enable-compat30, wx will NOT be useable
 * wxWidgets don't have gl support, wx will NOT be useable
 * Can not link wx program are all developer packages installed?

Build failed.
In file included from aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/globals.h:9:
aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/../core/api-config.h:45:10: fatal error: 'initializer_list' file not found
   45 | #include <initializer_list>
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.
make[4]: *** [aarch64-apple-darwin24.0.0/opt/jit/asmjit/asmjit.hpp.gch] Error 1
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

redac avatar Sep 24 '24 08:09 redac

I'm getting a different error on Apple Silicon with Xcode 16.0, any ideas?

Extracting source code
Building Erlang/OTP 27.1 (asdf_27.1), please wait...
APPLICATIONS DISABLED (See: /Users/redacted/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1/otp_build_27.1.log)
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - link check failed

APPLICATIONS INFORMATION (See: /Users/redacted/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1/otp_build_27.1.log)
 * wx             : wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
 * wxWidgets was not compiled with --enable-compat30, wx will NOT be useable
 * wxWidgets don't have gl support, wx will NOT be useable
 * Can not link wx program are all developer packages installed?

Build failed.
In file included from aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/globals.h:9:
aarch64-apple-darwin24.0.0/opt/jit/asmjit/./core/../core/../core/../core/../core/api-config.h:45:10: fatal error: 'initializer_list' file not found
   45 | #include <initializer_list>
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.
make[4]: *** [aarch64-apple-darwin24.0.0/opt/jit/asmjit/asmjit.hpp.gch] Error 1
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [jit] Error 2
make: *** [emulator] Error 2

If running ulimit -n 65536 didn't worked. You can try this https://github.com/asdf-vm/asdf-erlang/issues/319#issuecomment-2367630445. Don't update your xcode until issue is resolved.

obieewan avatar Sep 24 '24 08:09 obieewan

@redac I encountered the same issue ('initializer_list' file not found). I can confirm that reinstalling Xcode Command Line Tools resolved it. I followed these instructions to uninstall and then reinstall.

jdsampayo avatar Sep 25 '24 03:09 jdsampayo

reinstalling xcode fixed the issue for me i have M1 Pro

m13m avatar Oct 07 '24 10:10 m13m

Same for me.

On Apple M2 Pro, Sonoma 14.7, kerl 4.3.0 (without using any asdf)

kerl build-install 27.1.1

resulted in:

In file included from aarch64-apple-darwin23.6.0/opt/jit/asmjit/asmjit.hpp:27:
In file included from aarch64-apple-darwin23.6.0/opt/jit/asmjit/./core.h:1932:
In file included from aarch64-apple-darwin23.6.0/opt/jit/asmjit/./core/archtraits.h:9:
In file included from aarch64-apple-darwin23.6.0/opt/jit/asmjit/./core/../core/operand.h:9:
In file included from aarch64-apple-darwin23.6.0/opt/jit/asmjit/./core/../core/../core/archcommons.h:13:
In file included from aarch64-apple-darwin23.6.0/opt/jit/asmjit/./core/../core/../core/../core/globals.h:9:
aarch64-apple-darwin23.6.0/opt/jit/asmjit/./core/../core/../core/../core/../core/api-config.h:45:10: fatal error: 'initializer_list' file not found
   45 | #include <initializer_list>
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.
gmake[4]: *** [aarch64-apple-darwin23.6.0/Makefile:958: aarch64-apple-darwin23.6.0/opt/jit/asmjit/asmjit.hpp.gch] Error 1
gmake[4]: Leaving directory '/Users/dansari/.kerl/builds/27.1.1/otp_src_27.1.1/erts/emulator'
gmake[3]: *** [/Users/dansari/.kerl/builds/27.1.1/otp_src_27.1.1/make/run_make.mk:35: opt] Error 2
gmake[3]: Leaving directory '/Users/dansari/.kerl/builds/27.1.1/otp_src_27.1.1/erts/emulator'
gmake[2]: *** [Makefile:45: opt] Error 2
gmake[2]: Leaving directory '/Users/dansari/.kerl/builds/27.1.1/otp_src_27.1.1/erts'
gmake[1]: *** [Makefile:60: jit] Error 2
gmake[1]: Leaving directory '/Users/dansari/.kerl/builds/27.1.1/otp_src_27.1.1/erts'
gmake: *** [Makefile:483: emulator] Error 2

Re-installing xcode fixed this issue.

ansd avatar Oct 08 '24 07:10 ansd

It seems like reinstalling Xcode fixes this for a while, asterisk. When installing asdf_27.1.1 weeks back, I encountered the error, re-installed Xcode, and things were right-as-rain. When I tried to install asdf_27.1.2 this morning, though, I hit the same wall.

That said, this is also on the other side of updating macOS from one 15.1 Beta build to another, so it may be that some interplay between updating macOS and Xcode is the culprit?

Edit: Bumping the file descriptor limit temporarily via ulimit still works in this scenario, obv.

jbcaprell avatar Oct 18 '24 13:10 jbcaprell

Hello! πŸ‘‹ I'm getting a different error with OTP 27.1.2 on Apple M3 Max with Sequoia:

❯ KERL_CONFIGURE_OPTIONS="--disable-parallel-configure" asdf install erlang 27.1.2

ERROR: 'asdf_27.1.2' is not a kerl-managed Erlang/OTP installation.
Build 'asdf_27.1.2' has been deleted.
Extracting source code for normal build...
Building (normal) Erlang/OTP 27.1.2 (asdf_27.1.2); please wait...
Initializing (build) log file at /Users/imcosta/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1.2/otp_build_27.1.2.log.
Attempting to use Homebrew OpenSSL from /usr/local/opt/[email protected]...
... found!
APPLICATIONS DISABLED (See: /Users/imcosta/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1.2/otp_build_27.1.2.log)
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - link check failed

APPLICATIONS INFORMATION (See: /Users/imcosta/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1.2/otp_build_27.1.2.log)
 * wx             : wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
 * Can not link wx program are all developer packages installed?

ERROR: build failed.
=== Leaving application mnesia
=== Entering application crypto
make[3]: Nothing to be done for `opt'.
 MAKE   opt
make[4]: aarch64-apple-darwin24.0.0/Makefile: No such file or directory
make[4]: *** No rule to make target `aarch64-apple-darwin24.0.0/Makefile'.  Stop.
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [libs] Error 2

I tried different things:

  • Reinstall Xcode Command Line Tools following this
  • Change ulimits
  • Use CPP=cpp EGREP=egrep KERL_CONFIGURE_OPTIONS="--enable-darwin-64bit --disable-parallel-configure"
  • Remove the --disable-parallel-configure but in that case I got a different error:
checking for OpenSSL header in /usr/local/opt/[email protected]... yes
checking for OpenSSL in /usr/local/opt/[email protected]... configure: error: neither static nor dynamic crypto library found in /usr/local/opt/[email protected]
ERROR: /Users/imcosta/.asdf/plugins/erlang/kerl-home/builds/asdf_27.1.2/otp_src_27.1.2/lib/crypto/configure failed!

At this point I don't know what to do. Any ideas? Thanks!

imcosta avatar Nov 01 '24 13:11 imcosta

I solved my Erlang installation with the following:

$ KERL_CONFIGURE_OPTIONS="--disable-jit" asdf install erlang 25.1.2

Refernce: https://github.com/erlang/otp/issues/7687#issuecomment-1737184968

prodis avatar Nov 06 '24 09:11 prodis

This is an odd issue because I do not see this issue on my Intel MacBook Pro 11.7 (Big Sur). Here are my findings:

Intel MacBook Pro using Apple Terminal app

➜ ulimit -n 
256
➜ sysctl -a | grep maxfiles
kern.maxfiles: 49152
kern.maxfilesperproc: 24576
  • asdf install erlang 26.2.5.5 (SUCCESS)
  • asdf install erlang 27.1.2 (SUCCESS)

Apple Silicon MacBook Pro using Apple Terminal app

➜ ulimit -n 
256
➜ sysctl -a | grep maxfiles
kern.maxfiles: 491520
kern.maxfilesperproc: 245760
  • asdf install erlang 26.2.5.5 (FAILURE)
  • asdf install erlang 27.1.2 (FAILURE)

Apple Silicon MacBook Pro using Warp terminal app

➜ ulimit -n
2560
➜ sysctl -a | grep maxfiles
kern.maxfiles: 491520
kern.maxfilesperproc: 245760
  • asdf install erlang 26.2.5.5 (SUCCESS)
  • asdf install erlang 27.1.2 (SUCCESS)

This appears to be an issue with the number of default file descriptors on the Terminal app. When I switched the terminal app to Warp, the issue, 'Too many open files', disappeared.

Finally, I did file an issue via the Feedback Assistant app.

conradwt avatar Nov 07 '24 06:11 conradwt

I encountered the same issue on Apple Silicon with Xcode 16.0. A temporary fix that worked for me was adjusting the ulimit to increase the number of allowed open files. Here’s what I did:

  1. Open terminal.
  2. Run ulimit -n 65536 to increase the limit.
  3. Retry the installation.

This is a temporary solution, and if needed, the change can be made permanent by modifying system configuration files.

Hope this helps!

this worked for me

kasvith avatar Nov 09 '24 09:11 kasvith

ulimit worked for me as well, with 27.1.2, on macOS Sonoma 14.7.1, Xcode 15

shribe avatar Nov 09 '24 21:11 shribe

My friend succeeded to install Erlang/OTP 27.1.2 to M4 Mac mini.

zacky1972 avatar Nov 10 '24 04:11 zacky1972

Running ulimit -n 65536 worked for me as well, Sequoia 15.1.1, Xcode 16.1

jeramyRR avatar Dec 08 '24 17:12 jeramyRR

I'm no longer having build issues with macOS 15.1.1 and Xcode 16.1. For example,

Apple Silicon MacBook Pro using Apple Terminal app

➜ ulimit -n 
256
➜ sysctl -a | grep maxfiles
kern.maxfiles: 491520
kern.maxfilesperproc: 245760
  • asdf install erlang 26.2.5.6 (SUCCESS)

  • asdf install erlang 27.1.3 (SUCCESS)

conradwt avatar Dec 09 '24 00:12 conradwt

Hi! πŸ‘‹ I had to deal with all the errors above trying to fix my Elixir installation πŸ˜‚ To get the installation working on my MacBook Pro M1 (Sequoia 15.1.1) I did a mix of a mix of this and this. Also, thanks @obieewan for this suggestion and @haavars for this as well πŸ™‡

EDIT: My previous installation of Erlang was made using --without-wx as a KERL install option. As a result, I've found that the :observer does not work. I now need the observer to work, and that is why I build wxmac and go through the trouble of fixing the wx installation.

  1. Uninstall ASDF

rm -rf ~/.asdf brew uninstall asdf brew autoremove

  1. Uninstall Xcode CMD line tools

xcode-select -p to see the directory where they are (likely to be /Library/Developer/CommandLineTools) sudo rm -rf /Library/Developer/CommandLineTools

  1. Reinstall Xcode CMD line tools

Xcode-select --install Accept the pop up

  1. Reinstall ASDF

brew install asdf asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git (I am installing Elixir)

  1. Build wxmac (now wxwidgets) from source

brew uninstall wxmac --> This is the culprit of the wx error brew autoremove brew install --build-from-source wxmac --> Building it from source fixes the issue.

  1. Reinstall Erlang

asdf plugin-update erlang brew install openjdk echo 'export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"' >> ${ZDOTDIR:-~}/.zshrc source ${ZDOTDIR:-~}/.zshrc brew install fop export CC="/usr/bin/clang -I$(brew --prefix unixodbc)/include" export LDFLAGS=-L$(brew --prefix unixodbc)/lib export KERL_CONFIGURE_OPTIONS="--with-ssl=$(brew --prefix openssl@3) --with-odbc=$(brew --prefix unixodbc)" ulimit -n 65536 --> The "too many files open" asdf install erlang latest asdf global erlang latest unset CC LDFLAGS

  1. (Optional, for Elixir) Reinstall Elixir

asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git asdf install elixir latest

ppicom avatar Jan 04 '25 09:01 ppicom

Looking into this issue now. Thanks a lot for the notes @ppicom.

The right version of openssl isn't picked up because kerl (reference) seems to be looking for this:

brew --prefix [email protected]

The command should actually be the following:

brew --prefix openssl@3

Here's the console output.

$ ls $(brew --prefix [email protected])
ls: /opt/homebrew/opt/[email protected]: No such file or directory

$ ls $(brew --prefix openssl@3)
/opt/homebrew/opt/openssl@3

HashNuke avatar Mar 16 '25 11:03 HashNuke

Please update to latest master branch of this plugin. Issues mentioned on this ticket should be fixed.

HashNuke avatar Mar 16 '25 14:03 HashNuke

#334.

PR has some screenshots and notes.

HashNuke avatar Mar 16 '25 14:03 HashNuke

I was still facing similar errors. Uninstalling xcode and then reinstalling. Then a clean asdf, erlang and elixir install solved the problems on my mac m1 machine with macOS Sequoia 15.3.2.

Uninstalling xcode: sudo rm -rf /Library/Developer/CommandLineTools And reinstalling it using xcode-select --install

nvzard avatar Mar 23 '25 09:03 nvzard

For anyone reading this thread. Along with xcode command line tools, ensure your kerl is updated too:

rm  ~/.asdf/plugins/erlang/kerl

The above command removes kerl that asdf-erlang installs. When you run a command to install an erlang version, the latest version of kerl will be downloaded again.

HashNuke avatar Mar 23 '25 10:03 HashNuke