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

Cannot make erlang install with wxwidgets on mac

Open nicnilov opened this issue 6 months ago • 2 comments

As it sometimes happens, an uncontrolled brew upgrade seems to have messed up the compatibility of the asdf-installed packages.

I use asdf to install Erlang, however the wxwidgets, openssl, and some other dependencies, as well as asdf itself, are installed by brew. I had Erlang 27.1.2 installed for quite some time, and recently discovered that the :observer doesn't start anymore, crashing complaining about missing a wx binary.

Trying to resolve this I attempted several reinstalls, building various versions of wxwidgets, including in interactive mode with the --enable-compat30, etc. Similarly I built erlang with many combinations of switches in its KERL_CONFIGURE_OPTIONS. Even though sometimes I was able to go through with the installation itself, the resulting setup was not working. The :observer was still failing to start with various issues still pointing to wxwidgets. Finally I decided to give up and uninstalled the asdf's erlang versions and the plugin itself, as well as whatever custom-built wxwidgets I had in brew, and reinstalled everything from brew via brew install erlang@27. This was what finally fixed the installation and :observer started working. However now my build tools are interspersed between asdf and brew, and the erlang version switching became more difficult.

This is not the first time I'm having issues with this plugin and asdf in general after its transition to brew. Last upgrade round also required some manual fiddling with erlang build flags, etc. I don't know if this is related, but when asdf was just a plain cloned repo, it used to work very well and was stable between the upgrades. Now that the result is an inconsistent install of things in random places I think I'm going to look for another solution beyond asdf.

nicnilov avatar Aug 25 '25 23:08 nicnilov

Here is my workaround.

I needed elixir 1.17.3-otp-27 to work with erlang 27.3.4.2 and elixir 1.18.4-otp-28 with erlang 28.0.2. Since I couldn't find a way to install erlang via asdf, I had to do that via brew:

brew install erlang@27
brew install erlang  # this currently installs version 28

Then I had to manually create asdf shims for the erlang versions. Before that I needed to make sure asdf erlang plugin is installed:

asdf plugin add erlang

Now under the ~/.asdf/installs/ directory:

# make sure erlang installs directory exists
mkdir -p erlang && cd erlang

# make an entry for Erlang 27, symlinking it to the brew-installed version
mkdir -p 27.3.4.2 && cd 27.3.4.2
ln -s /opt/homebrew/opt/erlang@27/bin ~/.asdf/installs/erlang/27.3.4.2/bin

# back to the erlang installs dir
cd ..

# make an entry for Erlang 28, symlinking it to the brew-installed version
mkdir -p 28.0.2 && cd 28.0.2
ln -s /opt/homebrew/opt/erlang/bin ~/.asdf/installs/erlang/28.0.2/bin

# create the asdf erlang shims
asdf reshim erlang 27.3.4.2
asdf reshim erlang 28.0.2

At this point it should become possible to switch the Elixir versions as usual via the .tool-versions file.

This of course is not a maintainable solution since the next brew upgrade ... may update the installed minor versions of Erlang which will break the config. However, as a short term approach it is better than nothing.

nicnilov avatar Sep 22 '25 14:09 nicnilov

Can confirm this still happens with asdf install erlang 28.1.1:

  • without wxmac or wxwidgets installed, installation completes successfully, but wx is disabled because no wxmac or wxwidgets installation was detected.
  • with wxmac 3.3.1 installed through Homebrew, installation completes successfully, but wx is disabled because wxwidgets was not compiled with the --enable-compat30 flag.
  • with wxmac 3.3.1 installed through Homebrew, with a manual edit to the formula to add the --enable-compat30 flag, installation fails because of a compilation error, see below.
  • with [email protected] installed through Homebrew, regardless of whether --enable-compat30 has been added, installation completes succesfully, but wx is disabled because wxmac was not detected to be installed. Even though I regularly get the warning from Homebrew that wxmac has been renamed to wxwidgets, asdf-erlang does not detect wxwidgets, only wxmac
Click to show compilation error logs
[asdf-erlang] ⚠️ Warning: fop is optional and not installed. Please install it using 'brew install fop'.
[asdf-erlang] ⚠️ Warning: unixodbc is optional and not installed. Please install it using 'brew install unixodbc'.
[asdf-erlang] ⚠️ Warning: openjdk is optional and not installed. Please install it using 'brew install openjdk'.
[asdf-erlang] 🛟 Added unixodbc to KERL_CONFIGURE_OPTIONS:  --with-odbc=/opt/homebrew/opt/unixodbc
[asdf-erlang] 🛟 No CC found. Setting CC to: /usr/bin/clang -I/opt/homebrew/opt/unixodbc/include
[asdf-erlang] 🛟 No LDFLAGS found. Setting LDFLAGS to: -L/opt/homebrew/opt/unixodbc/lib
[asdf-erlang] 🛟 Added openssl to KERL_CONFIGURE_OPTIONS:  --with-ssl=/opt/homebrew/opt/openssl@3
[asdf-erlang] 🛟 OpenJDK has been added to PATH for this terminal session: /opt/homebrew/opt/openjdk/bin
[asdf-erlang] Please ensure this is included in your shell's dot files (.zshrc, .bashrc, etc.)
[asdf-erlang] 📦 Building with KERL_CONFIGURE_OPTIONS=  --with-odbc=/opt/homebrew/opt/unixodbc  --with-ssl=/opt/homebrew/opt/openssl@3
[asdf-erlang] ❄️ No kerl installation to cleanup for asdf_28.1.1
[asdf-erlang] ❄️ No kerl build to cleanup for asdf_28.1.1
Downloading (from GitHub) Erlang/OTP 28.1.1 to /Users/admin/.asdf/downloads/erlang/28.1.1...
Extracting source code for normal build...
Building (normal) Erlang/OTP 28.1.1 (asdf_28.1.1); please wait...
Initializing (build) log file at /Users/admin/.asdf/plugins/erlang/kerl-home/builds/asdf_28.1.1/otp_build_28.1.1.log.
APPLICATIONS DISABLED (See: /Users/admin/.asdf/plugins/erlang/kerl-home/builds/asdf_28.1.1/otp_build_28.1.1.log)
 * jinterface     : No Java compiler found
 * odbc           : ODBC library - header check failed

ERROR: build failed.
gen/wxe_init.cpp:7177:18: error: invalid application of 'sizeof' to an incomplete type 'wxe_defs[]'
 7177 |   int sz = sizeof(defs) / sizeof(defs[0]);
      |                  ^~~~~~
4 warnings and 9 errors generated.
make[3]: *** [aarch64-apple-darwin24.6.0/wxe_init.o] Error 1
make[3]: *** Waiting for unfinished jobs....
1 warning generated.
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [libs] Error 2

Please see /Users/admin/.asdf/plugins/erlang/kerl-home/builds/asdf_28.1.1/otp_build_28.1.1.log for full details.
Auto cleaning all artifacts except the log file...
(use KERL_AUTOCLEAN=0 to keep build on failure, if desired)
Cleaning up compilation products for 'asdf_28.1.1' under:
  - /Users/admin/.asdf/plugins/erlang/kerl-home/builds...
  - /Users/admin/.asdf/downloads/erlang/28.1.1...
... done.
error installing version: failed to run install callback: exit status 1

bvobart avatar Nov 10 '25 12:11 bvobart