colibri

colibri

Hi,

MacBook Pro (13-inch, M1, 2020)
MacOS Big Sur 11.3.1
Homebrew (all updated to the latest version)

After updating to erlang (24.0 OTP) and elixir (1.12)

colibri@colibri-core ~ % erl
zsh: segmentation fault  erl
colibri@colibri-core ~ % iex
zsh: segmentation fault  iex
colibri@colibri-core ~ % mix local.rebar
zsh: segmentation fault  mix local.rebar
colibri@colibri-core ~ % mix local.hex                  
zsh: segmentation fault  mix local.hex
colibri@colibri-core ~ % mix archive.install hex phx_new
zsh: segmentation fault  mix archive.install hex phx_new

after a while

colibri@colibri-core ~ % iex
Erlang/OTP 24 [erts-12.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Interactive Elixir (1.12.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
a
colibri@colibri-core ~ % iex
zsh: segmentation fault  iex

Showing Posts 1 to 10

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

How did you install Erlang / Elixir?

dmitrykleymenov

dmitrykleymenov

I see [jit], could it be related that support of M1 is only in development? https://twitter.com/josevalim/status/1395702461776728064

colibri

colibri OP

brew install erlang (elixir) - еverything was working fine before
updated yesterday - brew update && brew upgrade - and this problem appeared

P.S I always have fresh erlang/elixir updates on M1, previous versions worked fine, earlier there was a problem with :observer.start(), I fixed it.

colibri

colibri OP

Yes, the problem is only on the M1
iMac 3,5 GHz Intel Core i5, works great after the upgrade erlang/elixir

dmitrykleymenov

dmitrykleymenov

…You can either completely disable BeamAsm by passing --disable-jit to configure. …
Erlang -- BeamAsm, the Erlang JIT

So, just turn it off

colibri

colibri OP

Thanks!
Yes, I did it yesterday, but this is a temporary solution, the problem of building with --enable-jit option remains the same.

We have updated Erlang(24.0.1 OTP) and Elixir (1.12.0) installed via Homebrew.
When running interactive mode (erl or iex) we got a segmentation fault error.
For correctly work Erlang/Elixir, we need to disable jit option in Erlang and update wxmac from version 3.0.5.1 to version 3.1.4 to make :observer.start() work properly
So, let’s do it…

STEPS:

  1. Edit Formula brew edit erlang
  2. Add --disable-jit option to def installargs list
  3. Save Formula
  4. Edit Formula brew edit wxmac
  5. Replace the lines url and sha256 with these
    url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/wxWidgets-3.1.4.tar.bz2"
    sha256 "3ca3a19a14b407d0cdda507a7930c2e84ae1c8e74f946e0144d2fa7d881f1a94"
  6. Comment bottle section
  # bottle do
  #   sha256 cellar: :any, arm64_big_sur: "f8d6ccae11c8d99b893e2605ca272a376a374faac8864304d1cdf544c6152421"
  #   sha256 cellar: :any, big_sur:       "95b66fefa42f869430da0597abb27500d551d5f99662e285c4f0d3a9e2800bdf"
  #   sha256 cellar: :any, catalina:      "110aa0b2134d8bff1647de0cd8500f160133794b347f789bba3e1894b991b788"
  #   sha256 cellar: :any, mojave:        "5f703423fc3f1e36d647a2d8be2d271a92f5d60f49ceba8e3478391bbd4f5303"
  #   sha256 cellar: :any, high_sierra:   "1de8aa03e1c50af387888ffa51cfa4e0c99d158f25edb0acbf312e10c629a31d"
  # end
  1. Add "--enable-compat28", option to def installargs list
  2. Save Formula
  3. brew upgrade wxmac

DONE

colibri@colibri-core ~ % iex
Erlang/OTP 24 [erts-12.0.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace]

Interactive Elixir (1.12.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 
bjorng

bjorng

Erlang Core Team

I can’t reproduce your problem.

It should not be possible to have the JIT enabled in OTP 24 on an M1 Mac, because the configure script will complain if you try to enable the JIT:

./configure --enable-jit
.
.
.
configure: error: JIT only works on x86 64-bit
ERROR: /Users/bjorng/git/otp/erts/configure failed!

If you run ./configure without any other options, the JIT will be automatically disabled unless the platform is x86_64.

I can only assume that something very weird happened when homebrew upgraded the version of Erlang to OTP 24. I can’t reproduce the problem myself, because I have never used homebrew before and can’t do the same update and upgrade that you did. When I downloaded homebrew for the first time and installed Erlang on my M1 Mac, it worked immediately without any problems.

I would recommend that you remove the --disable-jit line from the homebrew formula and force homebrew to rebuild Erlang from scratch. That should work. If not, I would be very interested in build logs to see what parameters homebrew passed to configure and which environment variables that were set. If it happens to be a bug in the configure script for the OTP that would incorrectly enable the JIT on a M1 under some circumstances, I would want to fix it.

colibri

colibri OP

colibri@colibri-core ~ % brew install -s erlang                    
==> Downloading https://ghcr.io/v2/homebrew/core/wxmac/manifests/3.0.5.1_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/wxmac/blobs/sha256:95b66fefa42f869430da0597abb27500d551d5f99662e285c4f0d3a9e2800bdf
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:95b66fefa42f869430da0597abb27500d551d5f99662e285c4f0d3a9e2800bdf?se=2021-05-23T08%3A15%3A00Z&s
######################################################################## 100.0%
==> Downloading https://www.erlang.org/download/otp_doc_html_24.0.tar.gz
==> Downloading from http://erlang.org/download/otp_doc_html_24.0.tar.gz
######################################################################## 100.0%
==> Downloading https://github.com/erlang/otp/releases/download/OTP-24.0.1/otp_src_24.0.1.tar.gz
==> Downloading from https://github-releases.githubusercontent.com/374927/851c2280-b983-11eb-8807-475fd4248fef?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH5
######################################################################## 100.0%
==> Installing dependencies for erlang: wxmac
==> Installing erlang dependency: wxmac
==> Pouring wxmac--3.0.5.1_1.big_sur.bottle.tar.gz
🍺  /usr/local/Cellar/wxmac/3.0.5.1_1: 810 files, 52.2MB
==> Installing erlang
==> ./configure --prefix=/usr/local/Cellar/erlang/24.0.1 --enable-dynamic-ssl-lib --enable-hipe --enable-shared-zlib --enable-smp-support --enable-threads --enable-wx --with-ssl=/
==> make
Last 15 lines from /Users/colibri/Library/Logs/Homebrew/erlang/02.make:
           < megaco_flex_scanner_drv.flex.src > megaco_flex_scanner_drv_mt.flex
flex -Ca -Pmegaco_flex_scanner_drv -omegaco_flex_scanner_drv.c megaco_flex_scanner_drv.flex
flex -R -Ca --yylineno -Pmegaco_flex_scanner_drv_mt -omegaco_flex_scanner_drv_mt.c megaco_flex_scanner_drv_mt.flex
compiling std driver:
clang -c -DMEGACO_DRV_NAME=\"megaco_flex_scanner_drv\" -fno-common -Werror=return-type -g -O2 -fPIC -fno-common -DOTP_RELEASE -DMFS_FLEX_DEBUG=0 -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/emulator/beam -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include/x86_64-apple-darwin20.4.0 -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include/internal -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include/internal/x86_64-apple-darwin20.4.0 -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/emulator/sys/unix -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/emulator/sys/common -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/x86_64-apple-darwin20.4.0  -funroll-loops -Wall -DMEGACO_LINENO -o ../../priv/obj/x86_64-apple-darwin20.4.0/megaco_flex_scanner_drv.o megaco_flex_scanner_drv.c
compiling multi-threaded driver:
clang -c -DMEGACO_DRV_NAME=\"megaco_flex_scanner_drv_mt\" -fno-common -Werror=return-type -g -O2 -fPIC -fno-common -DOTP_RELEASE -DMFS_FLEX_DEBUG=0 -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/emulator/beam -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include/x86_64-apple-darwin20.4.0 -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include/internal -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/include/internal/x86_64-apple-darwin20.4.0 -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/emulator/sys/unix -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/emulator/sys/common -I/private/tmp/erlang-20210523-57611-1ctzn8v/otp_src_24.0.1/erts/x86_64-apple-darwin20.4.0  -funroll-loops -Wall -DMEGACO_LINENO  -D_THREAD_SAFE -D_REENTRANT -DPOSIX_THREADS -DMEGACO_REENTRANT_FLEX_SCANNER -o ../../priv/obj/x86_64-apple-darwin20.4.0/megaco_flex_scanner_drv_mt.o megaco_flex_scanner_drv_mt.c
make[5]: *** [../../ebin/megaco_flex_scanner.beam] Segmentation fault: 11
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [../../ebin/megaco_flex_scanner_handler.beam] Segmentation fault: 11
make[4]: *** [opt] Error 2
make[3]: *** [opt] Error 2
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [libs] Error 2

READ THIS: https://docs.brew.sh/Troubleshooting

These open issues may also help:
erlang@21 21.3.8.23 https://github.com/Homebrew/homebrew-core/pull/77725
colibri@colibri-core ~ %

Where do I send the installation log(01.configure and if needed 02.make)?

2021-05-23 11:17:48 +0300

./configure
--disable-debug
--disable-silent-rules
--prefix=/usr/local/Cellar/erlang/24.0.1
--enable-dynamic-ssl-lib
--enable-hipe
--enable-shared-zlib
--enable-smp-support
--enable-threads
--enable-wx
--with-ssl=/usr/local/opt/openssl@1.1
--without-javac
--enable-darwin-64bit
--enable-kernel-poll
--with-dynamic-trace=dtrace

=== Running configure in /private/tmp/erlang-20210523-78454-1pyowcr/otp_src_24.0.1/erts ===
./configure '--disable-debug' '--disable-silent-rules' '--prefix=/usr/local/Cellar/erlang/24.0.1' '--enable-dynamic-ssl-lib' '--enable-hipe' '--enable-shared-zlib' '--enable-smp-support' '--enable-threads' '--enable-wx' '--with-ssl=/usr/local/opt/openssl@1.1' '--without-javac' '--enable-darwin-64bit' '--enable-kernel-poll' '--with-dynamic-trace=dtrace' --disable-option-checking --cache-file=/dev/null --srcdir="/private/tmp/erlang-20210523-78454-1pyowcr/otp_src_24.0.1/erts"
checking build system type... x86_64-apple-darwin20.4.0
checking host system type... x86_64-apple-darwin20.4.0
checking for gcc... clang
2021-05-23 12:12:47 +0300

make

Makefile:1235: warning: overriding commands for target `dialyzer'
Makefile:510: warning: ignoring old commands for target `dialyzer'
test X"$ERTS_SKIP_DEPEND" = X"true" || (cd erts/emulator && PATH=/private/tmp/erlang-20210523-30020-1ujj30m/otp_src_24.0.1/bootstrap/bin:"${PATH}" ERL_TOP=/private/tmp/erlang-20210523-30020-1ujj30m/otp_src_24.0.1 make generate)
/Library/Developer/CommandLineTools/usr/bin/make -f x86_64-apple-darwin20.4.0/Makefile generate
if utils/gen_git_version x86_64-apple-darwin20.4.0/gen_git_version.mk; then touch beam/erl_bif_info.c; fi
dtrace -h -C -Ibeam -s beam/erlang_dtrace.d -o ./erlang_dtrace.tmp
LANG=C /usr/bin/perl utils/beam_makeops \
		-wordsize 64 \
		-code-model @CODE_MODEL@ \
		-outdir x86_64-apple-darwin20.4.0/opt/jit \
		-jit yes \
		-DUSE_VM_PROBES=1 \
		-emulator /private/tmp/erlang-20210523-30020-1ujj30m/otp_src_24.0.1/lib/compiler/src/genop.tab beam/predicates.tab beam/generators.tab beam/jit/x86/ops.tab beam/jit/x86/predicates.tab beam/jit/x86/generators.tab && echo /private/tmp/erlang-20210523-30020-1ujj30m/otp_src_24.0.1/lib/compiler/src/genop.tab beam/predicates.tab beam/generators.tab beam/jit/x86/ops.tab beam/jit/x86/predicates.tab beam/jit/x86/generators.tab utils/beam_makeops x86_64-apple-darwin20.4.0/Makefile >x86_64-apple-darwin20.4.0/opt/jit/OPCODES-GENERATED
LANG=C /usr/bin/perl utils/make_tables -src x86_64-apple-darwin20.4.0/opt/jit -include x86_64-apple-darwin20.4.0/opt/jit\
		-dst no -jit yes\
bjorng

bjorng

Erlang Core Team

No need to send any more files. I see the problem:

The build system type is determined as x86_64-apple-darwin20.4.0, not as aarch64-apple-darwin20.4.0 as it should be on an M1 Mac. That will cause configure to enable the JIT.

So it seems that on your M1 Mac homebrew is running under Rosetta emulation (emulating an Intel Mac), at least when the configure script is run. I don’t know why that is happening. Did the first versions of homebrew for M1 Macs run under emulation and you are still using that version? With my recently installed homebrew, the configure script correctly determines the build type to be aarch64-apple-darwin20.4.0.

colibri

colibri OP

I got this laptop in December 2020.
Installed Homebrew right away, it was only rosette-enabled at the time.

Thank you very much for pointing out this problem and for pointing out a solution.

STEPS:

  1. Delete Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
  2. Disabled the rosette support for the terminal.
  3. Cleaned the system from the debris left behind.
  4. Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

DONE

P.S It’s hard to be among the pioneers :slight_smile:

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews