"Can not link wx program" error when installing erlang

I want to use the observer program for my elixir apps.
Off late I am shown this warning when I try to install erlang using asdf

APPLICATIONS INFORMATION (See: /Users/keshav/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.7/otp_build_25.3.2.7.log)
 * wx             : Can not link wx program are all developer packages installed?

Erlang/OTP 25.3.2.7 (asdf_25.3.2.7) has been successfully built
Cleaning up compilation products for 25.3.2.7
Cleaned up compilation products for 25.3.2.7 under /Users/keshav/.asdf/plugins/erlang/kerl-home/builds

And on trying to run observer, I get the error

10:46:25.196 [error] ERROR: Could not find 'wxe_driver.so' in: /Users/keshav/.asdf/installs/erlang/25.3.2.7/lib/wx-2.2.2/priv

{:error,
 {{:load_driver, 'No driver found'},
  [
    {:wxe_server, :start, 1, [file: 'wxe_server.erl', line: 65]},
    {:wx, :new, 1, [file: 'wx.erl', line: 115]},
    {:observer_wx, :init, 1, [file: 'observer_wx.erl', line: 109]},
    {:wx_object, :init_it, 6, [file: 'wx_object.erl', line: 404]},
    {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}
  ]}}

Here is the part of logs that I think are wx related

=== Running configure in /Users/keshav/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.7/otp_src_25.3.2.7/lib/wx ===
./configure 'CC=clang' '--enable-darwin-64bit' '--with-ssl=/opt/homebrew/opt/openssl@1.1' --disable-option-checking --cache-file=/dev/null --srcdir="/Users/keshav/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.7/otp_src_25.3.2.7/lib/wx"
checking build system type... aarch64-apple-darwin22.6.0
checking host system type... aarch64-apple-darwin22.6.0
checking target system type... aarch64-apple-darwin22.6.0
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether clang accepts -g... yes
checking for clang option to enable C11 features... none needed
checking for g++... g++
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... none needed
checking for ranlib... ranlib
checking how to run the C preprocessor... clang -E
configure: Building for darwin22.6.0
checking for mixed mingw-gcc and native VC++ environment... no
checking for mixed cygwin and native MinGW environment... no
checking if we mix cygwin with any native compiler... no
checking if we mix msys with another native compiler... no
checking if we mix WSL with another native compiler... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking size of void *... 8
checking Checking wxWidgets for min version:... -mmacosx-version-min=14
checking if compiler accepts -ObjC... yes
checking if we can add -fno-move-loop-invariants to CXXNOOPT (via CFLAGS)... no
checking if we can add -fno-var-tracking-assignments to CXXNOOPT (via CFLAGS)... no
checking for GL/gl.h... no
checking for OpenGL/gl.h... yes
checking for GL/glu.h... no
checking for OpenGL/glu.h... yes
checking for wx-config... /opt/homebrew/bin/wx-config
checking for wxWidgets version >= 3.0.2 (--unicode)... yes (version 3.2.3)
checking for wxWidgets static library... no
checking for wxwidgets webview... yes
checking for wx-config... (cached) /opt/homebrew/bin/wx-config
checking for wxWidgets version >= 3.0.2 (--unicode --debug=yes)... yes (version 3.2.3)
checking for wxWidgets static library... no
checking for debug build of wxWidgets... yes
checking for wx-config... (cached) /opt/homebrew/bin/wx-config
checking for wxWidgets version >= 3.0.2 (--unicode --debug=no)... yes (version 3.2.3)
checking for wxWidgets static library... no
checking for standard build of wxWidgets... yes
checking for wxwidgets 3.0 compatibility ... yes
checking for wxwidgets opengl support... yes
checking for GLintptr... yes
checking for GLintptrARB... yes
checking for GLchar... yes
checking for GLcharARB... yes
checking for GLhalfARB... yes
checking for GLint64EXT... yes
checking GLU Callbacks uses Tiger Style... no
checking if we can link wxwidgets programs... no
checking if we can add -Werror=return-type to CFLAGS (via CFLAGS)... yes
checking if we can add -Werror=return-type to CXXFLAGS (via CFLAGS)... yes
configure: creating aarch64-apple-darwin22.6.0/config.status
config.status: creating config.mk
config.status: creating c_src/Makefile
configure: WARNING: Can not link wx program are all developer packages installed?

I have wxwidgets installed from brew

❯ wx-config --list                                                                                                                                                                 

    Default config is osx_cocoa-unicode-3.2

  Default config will be used for output

❯ wx-config --libs                                                                                                                                                                 
-L/opt/homebrew/lib   -framework IOKit -framework Carbon -framework Cocoa -framework QuartzCore -framework AudioToolbox -framework System -framework OpenGL -lwx_osx_cocoau_xrc-3.2 -lwx_osx_cocoau_html-3.2 -lwx_osx_cocoau_qa-3.2 -lwx_osx_cocoau_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2

Please help me figure this out.

Checkout the comments in this issue https://github.com/asdf-vm/asdf-erlang/issues/203#issuecomment-846602541 specifically this comment, perhaps they might offer some help. Maybe you need to set this before runnig asdf install erlang ...

export KERL_CONFIGURE_OPTIONS="--enable-wx --with-wx-config=<absolute path to executable>"

You can get the path to the wx-config executable by running which wx-config

:slight_smile: if you see that issue I’d raised a question there way back regarding installation on linux.

In any case, from reading the logs I don’t think the error has to do with the install script not being able to find the wx-config. It has something to do with linking or shared libraries but I don’t have the knowledge to solve that. ie I just tried with the flags --enable-wx and --with-wx-config.

I have tried reinstalling wxwidgets (brew reinstall wxwidgets) but I still get the same error.

That’s strange. I am a Linux user though, hopefully Mac users here can suggest solutions to your problem.

1 Like

This problem has been fixed in OTP 26.1.1. We plan to include a backport of the fix in the next emergency patch for OTP 25.

4 Likes

Oh so it is xcode related? I thought this was because of the new Macos and rolled back without any success. Thanks for this effort @bjorng :pray:

1 Like