Asdf-erlang: Unable to compile with wx on mac os x mojave

Created on 17 Feb 2019  路  9Comments  路  Source: asdf-vm/asdf-erlang

I am trying to build erlang on Mac OS X Mojave with wxWidgets but they are not recognized.

$ brew install autoconf wxmac
Warning: autoconf 2.69 is already installed and up-to-date
To reinstall 2.69, run `brew reinstall autoconf`
==> Installing dependencies for wxmac: jpeg, libpng and libtiff
==> Installing wxmac dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-9c.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring jpeg-9c.mojave.bottle.tar.gz
馃嵑  /usr/local/Cellar/jpeg/9c: 21 files, 733.4KB
==> Installing wxmac dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.36.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.6.36.mojave.bottle.tar.gz
馃嵑  /usr/local/Cellar/libpng/1.6.36: 27 files, 1.2MB
==> Installing wxmac dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.10_1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libtiff-4.0.10_1.mojave.bottle.tar.gz
馃嵑  /usr/local/Cellar/libtiff/4.0.10_1: 246 files, 3.5MB
==> Installing wxmac
==> Downloading https://homebrew.bintray.com/bottles/wxmac-3.0.4_1.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring wxmac-3.0.4_1.mojave.bottle.tar.gz
馃嵑  /usr/local/Cellar/wxmac/3.0.4_1: 813 files, 23.8MB

$ cat .tool-versions 
elixir 1.7.4
erlang 21.0

$ export KERL_CONFIGURE_OPTIONS="--without-javac"

$ asdf install
elixir 1.7.4 is already installed
Extracting source code
Building Erlang/OTP 21.0 (asdf_21.0), please wait...
Configure options have changed. Reconfiguring...
APPLICATIONS DISABLED (See: /Users/marcin/.asdf/plugins/erlang/kerl-home/builds/asdf_21.0/otp_build_21.0.log)
 * jinterface     : No Java compiler found

APPLICATIONS INFORMATION (See: /Users/marcin/.asdf/plugins/erlang/kerl-home/builds/asdf_21.0/otp_build_21.0.log)
 * wx             : wxWidgets not found, wx will NOT be usable

DOCUMENTATION INFORMATION (See: /Users/marcin/.asdf/plugins/erlang/kerl-home/builds/asdf_21.0/otp_build_21.0.log)
 * documentation  :
 *                  fop is missing.
 *                  Using fakefop to generate placeholder PDF files.

Most helpful comment

To add a final note, to get proper Dark Mode support on Mojave or later, a build of wxMac 3.1.2 or 3.1.3 is needed (the default 3.0.4 version in Homebrew will work but tools like Observer look broken when Dark Mode is enabled).

On Catalina a working wxMac 3.1.3 install of Erlang 22.2.8 can be obtained by doing the following:

$ brew edit wxmac # Use patch below
$ rm -rf ~/.asdf/plugins/erlang/kerl-home/builds/asdf_22.2.8 # if you have tried building this version previously
$ brew install wxmac --build-from-source
$ asdf install erlang 22.2.8

Patch for Homebrew 2.2.15-12-ga5a5a1a and default wxMac 3.0.5:

diff --git a/Formula/wxmac.rb b/Formula/wxmac.rb
index d80b02f9e..9c68e7363 100644
--- a/Formula/wxmac.rb
+++ b/Formula/wxmac.rb
@@ -1,8 +1,8 @@
 class Wxmac < Formula
   desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS)"
   homepage "https://www.wxwidgets.org"
-  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5/wxWidgets-3.0.5.tar.bz2"
-  sha256 "8aacd56b462f42fb6e33b4d8f5d40be5abc3d3b41348ea968aa515cc8285d813"
+  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2"
+  sha256 "fffc1d34dac54ff7008df327907984b156c50cff5a2f36ee3da6052744ab554a"
   head "https://github.com/wxWidgets/wxWidgets.git"

   bottle do
@@ -19,6 +19,7 @@ class Wxmac < Formula
   def install
     args = [
       "--prefix=#{prefix}",
+      "--enable-compat28",
       "--enable-clipboard",
       "--enable-controls",
       "--enable-dataviewctrl",

(edit: Updated to patch match latest Homebrew version, thanks to @gregors!)

All 9 comments

You may need to tell it where wx is on your system. I've had trouble with this in the past with this, and it turned out to be something trivial. Unfortunately I don't have anything written down in my notes.

Maybe helpful? https://github.com/kerl/kerl/issues/294

@mspanc Did you ever find a solution for this?

Hey @mspanc
I ran into the same problem. When using wxmac version3.0.6 seems to make Erlang compile fine, but version 3.1.x (tried both 3.1.1 and 3.1.2) creates the same issue (no wx).

Looking at these Erlang docs about compiling wx with wxWidgets, it looks like 3.1.x would need to be compiled with the --enable-compat28 for some reason? I haven't tried this, but it might work.

Looking at the wx changelog for the upcoming OTP 22, it looks like better support is coming, maybe that will resolve the issues without needing a specially compiled version.

Just hit this problem. After some research it turns out the following combination work:

  • Erlang 22.0.2 and wxmac 3.1.2 built with the --enable-compat28 flag
    sh $ brew edit wxmac # Use patch below $ brew install wxmac $ asdf install erlang 22.0.2
    Screen Shot 2019-06-06 at 12 39 22

What seems to be important is to clean out the complete build folder when building again after changing wxmac version using rm -rf ~/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0.2.

Patch for wxmac formula:

diff --git a/Formula/wxmac.rb b/Formula/wxmac.rb
index 60c0b777..c822c57d 100644
--- a/Formula/wxmac.rb
+++ b/Formula/wxmac.rb
@@ -1,9 +1,11 @@
 class Wxmac < Formula
   desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS)"
   homepage "https://www.wxwidgets.org"
-  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.4/wxWidgets-3.0.4.tar.bz2"
-  sha256 "96157f988d261b7368e5340afa1a0cad943768f35929c22841f62c25b17bf7f0"
-  revision 1
+  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.2/wxWidgets-3.1.2.tar.bz2"
+  sha256 "4cb8d23d70f9261debf7d6cfeca667fc0a7d2b6565adb8f1c484f9b674f1f27a"
   head "https://github.com/wxWidgets/wxWidgets.git"

   bottle do
@@ -21,6 +23,7 @@ class Wxmac < Formula
   def install
     args = [
       "--prefix=#{prefix}",
+      "--enable-compat28",
       "--enable-clipboard",
       "--enable-controls",
       "--enable-dataviewctrl",

(Note: --enable-compat28 is to enable wxWidgets 2.8 compatibility.)

Updating asdf to 0.7.2 and using the latest master version of asdf-erlang makes the 22.0.2 build pass out of the box with wxmac 3.0.4:

$ brew install wxmac
$ asdf install erlang 22.0.2

Closing this issue because I am not aware of any problems with asdf-erlang itself. If there is anything we can do improve asdf-erlang please open a new issue.

To add a final note, to get proper Dark Mode support on Mojave or later, a build of wxMac 3.1.2 or 3.1.3 is needed (the default 3.0.4 version in Homebrew will work but tools like Observer look broken when Dark Mode is enabled).

On Catalina a working wxMac 3.1.3 install of Erlang 22.2.8 can be obtained by doing the following:

$ brew edit wxmac # Use patch below
$ rm -rf ~/.asdf/plugins/erlang/kerl-home/builds/asdf_22.2.8 # if you have tried building this version previously
$ brew install wxmac --build-from-source
$ asdf install erlang 22.2.8

Patch for Homebrew 2.2.15-12-ga5a5a1a and default wxMac 3.0.5:

diff --git a/Formula/wxmac.rb b/Formula/wxmac.rb
index d80b02f9e..9c68e7363 100644
--- a/Formula/wxmac.rb
+++ b/Formula/wxmac.rb
@@ -1,8 +1,8 @@
 class Wxmac < Formula
   desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS)"
   homepage "https://www.wxwidgets.org"
-  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5/wxWidgets-3.0.5.tar.bz2"
-  sha256 "8aacd56b462f42fb6e33b4d8f5d40be5abc3d3b41348ea968aa515cc8285d813"
+  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2"
+  sha256 "fffc1d34dac54ff7008df327907984b156c50cff5a2f36ee3da6052744ab554a"
   head "https://github.com/wxWidgets/wxWidgets.git"

   bottle do
@@ -19,6 +19,7 @@ class Wxmac < Formula
   def install
     args = [
       "--prefix=#{prefix}",
+      "--enable-compat28",
       "--enable-clipboard",
       "--enable-controls",
       "--enable-dataviewctrl",

(edit: Updated to patch match latest Homebrew version, thanks to @gregors!)

Changes to use wxmac 3.1.4 with erlang 3.2, erlang 3.2.1

diff --git a/Formula/wxmac.rb b/Formula/wxmac.rb
index 463bb08543..94088c09e9 100644
--- a/Formula/wxmac.rb
+++ b/Formula/wxmac.rb
@@ -1,8 +1,8 @@
 class Wxmac < Formula
   desc "Cross-platform C++ GUI toolkit (wxWidgets for macOS)"
   homepage "https://www.wxwidgets.org"
-  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5.1/wxWidgets-3.0.5.1.tar.bz2"
-  sha256 "440f6e73cf5afb2cbf9af10cec8da6cdd3d3998d527598a53db87099524ac807"
+  url "https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.4/wxWidgets-3.1.4.tar.bz2"
+  sha256 "3ca3a19a14b407d0cdda507a7930c2e84ae1c8e74f946e0144d2fa7d881f1a94"
   license "wxWindows"
   revision 1
   head "https://github.com/wxWidgets/wxWidgets.git"
@@ -32,6 +32,7 @@ class Wxmac < Formula
   def install
     args = [
       "--prefix=#{prefix}",
+      "--enable-compat28",
       "--enable-clipboard",
       "--enable-controls",
       "--enable-dataviewctrl",

Successfully build OTP 23.3.4 with the Dark Mode support on macOS 10.15.7 Catalina, finally.

  • When you have already installed wxmac, you need to upgrade with brew upgrade wxmac --build-from-source.
  • If you have already installed Homebrew Erlang, it will be rebuilt from source.

Thanks for all the tips!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sorliem picture sorliem  路  4Comments

cehoffman picture cehoffman  路  3Comments

CraigCottingham picture CraigCottingham  路  4Comments

lpil picture lpil  路  6Comments

ejpcmac picture ejpcmac  路  5Comments