`:observer.start` crashes Erlang VM

Hey all :wave:

I’ve been studying elixir for the past month and I’m really enjoying it. I guess this is just a way of saying I’m fairly new to the language.

My problem happens when I open up an iex session and issue a :observer.start. This crashes the Erlang VM and I get this pretty scary error (this is just the first line of the error):

objc[48474]: Class wxNSAppController is implemented in both /usr/local/Cellar/wxmac/3.0.5.1_1/lib/libwx_osx_cocoau_core-3.0.0.5.0.dylib (0x1b029c50) and /usr/local/opt/wxmac/lib/libwx_osx_cocoau_core-3.0.dylib (0x1a9a1c50). One of the two will be used. Which one is undefined.

As you can see, I’ve installed elixir and its dependencies via HomeBrew. Here’s the version of Elixir I’m running on my Mac.

$ elixir -v
Erlang/OTP 23 [erts-11.1.5] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.11.3 (compiled with Erlang/OTP 23)

I’m running on Mac with BigSur 11.1.

I’ve asked a friend of mine to try the same thing on his machine, however running on the latest Catalina version, and things worked just fine. I’m assuming this is a MacOS problem, but I’m not quite sure yet.

I’d really appreciate any help on how to fix this issue. If I miss any info, please let me know.

Thanks!

2 Likes

How did you install Erlang? I installed it both through homebrew and then through asdf and both worked just fine out of the box.

Can you post the output of brew info erlang? Maybe wxmac wasn’t installed (or errored out on install)?

If you use darkmode I’d also suggest:

2 Likes

That looks exhausting to do. I am guessing there’s no way to achieve the same with some sort of a kerl flag passed to it through asdf?

It’s basically editing one file with a handful of changes, so brew installs the recent development version of wxwidgets. After that you can build erlang however you want (not sure if rebuilding is required however).

here’s the output of brew info:

$ brew info erlang
erlang: stable 23.2.1 (bottled), HEAD
Programming language for highly scalable real-time systems
https://www.erlang.org/
/usr/local/Cellar/erlang/23.2.1 (7,978 files, 460.7MB) *
  Poured from bottle on 2021-01-15 at 11:31:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/erlang.rb
License: Apache-2.0
==> Dependencies
Build: autoconf ✔, automake ✘, libtool ✘
Required: openssl@1.1 ✔, wxmac ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

Access them with `erl -man`, or add this directory to MANPATH.
==> Analytics
install: 30,248 (30 days), 96,829 (90 days), 358,251 (365 days)
install-on-request: 14,875 (30 days), 43,588 (90 days), 117,420 (365 days)
build-error: 0 (30 days)

I can see the wxmac package was installed as a dependency when I erlang was installed. Are you running on the same version of OS as me? That’s strange.

btw… thanks for helping to look into it.

I’m not really using dark mode. But thanks for sharing the article. I came across that one on my searches.

Hi @albiere, I have the same problem you have, also on BigSur :sweat_smile:

@rodrigues Were you able to test whether this error occurs on Catalina as well?

No, I didn’t. I have another mac in BigSur with no wxmac problems :upside_down_face:

The system seems confused for conflicting dylibs, but also doesn’t work without installing wxmac. Gotta still crack this…

I’ve met the same problem in below environment:

macOS Big Sur version 11.1
$ brew info erlang
erlang: stable 23.2.2 (bottled), HEAD
Programming language for highly scalable real-time systems
https://www.erlang.org/
/usr/local/Cellar/erlang/23.2.1 (7,978 files, 460.7MB) *
  Poured from bottle on 2021-01-14 at 00:25:29
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/erlang.rb
License: Apache-2.0
==> Dependencies
Build: autoconf ✘, automake ✘, libtool ✔
Required: openssl@1.1 ✔, wxmac ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
Man pages can be found in:
  /usr/local/opt/erlang/lib/erlang/man

Access them with `erl -man`, or add this directory to MANPATH.
==> Analytics
install: 29,723 (30 days), 97,041 (90 days), 357,716 (365 days)
install-on-request: 14,520 (30 days), 43,683 (90 days), 117,476 (365 days)
build-error: 0 (30 days)
$ brew info wxmac
wxmac: stable 3.0.5.1 (bottled), HEAD
Cross-platform C++ GUI toolkit (wxWidgets for macOS)
https://www.wxwidgets.org
/usr/local/Cellar/wxmac/3.0.5.1_1 (810 files, 52.2MB) *
  Poured from bottle on 2021-01-14 at 00:25:13
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/wxmac.rb
License: wxWindows
==> Dependencies
Required: jpeg ✔, libpng ✔, libtiff ✔
==> Options
--HEAD
        Install HEAD version
==> Analytics
install: 12,204 (30 days), 44,651 (90 days), 213,507 (365 days)
install-on-request: 1,821 (30 days), 5,313 (90 days), 23,234 (365 days)
build-error: 0 (30 days)

The only difference I can see between both you plus @albiere and my setup is that I have both automake and autoconf. Try installing them (both install through brew install) and then uninstall and install Erlang again?

@dimitarvp let me give it try right now. Thanks btw!

No deal unfortunately.

I installed automake and autoconf and reinstalled elixir - and its dependencies - but the error continues. :confused:

Thanks for the advice.

I’ve tried but still have the problem :frowning:

I think this is related to wxwidgets support for big sur, not sure why it’s working for some and not for others. I’m using asdf to build erlang and to get that working I had to follow the steps outlined in https://github.com/asdf-vm/asdf-erlang/issues/183#issuecomment-762113618 .

You might (untested) be able to install a newer wxmac and rebuild brew erlang:

$ brew uninstall wxmac erlang
$ brew install cdalvaro/tap/wxmac
$ brew install --build-from-source --ignore-dependencies erlang

This seems to be a good summary to get started with asdf: https://www.cogini.com/blog/using-asdf-with-elixir-and-phoenix/ .

2 Likes

Thank you so much for the tip, but it didn’t quite work for me. I followed you recipe but building Erlang from source didn’t “link” wxmac, resulting in errors. I tried looking up for a flag that I could update in the configure process, but I’m not really familiar with building Erlang from source.

It’s far from what I’m comfortable with as well, but that’s how we learn :slight_smile:

Assuming you followed the brew build, you can try brew install --build-from-source --ignore-dependencies --HEAD erlang (to get homebrew to install erlang master), or to follow this and then rebuild erlang:

  • brew edit cdalvaro/tap/wxmac
  • Remove the bottle do block
  • Add “–enable-compat28”, to the args list in install
  • brew install cdalvaro/tap/wxmac

Other than that I’m out of ideas.

@michaelwm This solution worked for me. Thank you so much for sharing it.

@mattiaslundberg I think you solution would’ve worked too, but when I tried it, Erlang was recognizing the new wxmac as a dependency. That’s probably because of homebrew. Thanks anyway for your help.

1 Like

@michaelwm 's suggestion worked for me but I also had to remove the bottle do block while editing wxmac (as suggested by @mattiaslundberg ).

2 Likes