Skip to content

Instantly share code, notes, and snippets.

@zeejers
Last active November 27, 2022 19:43
Show Gist options
  • Save zeejers/b56d6a69e06ff674dff672fa9696dd62 to your computer and use it in GitHub Desktop.
Save zeejers/b56d6a69e06ff674dff672fa9696dd62 to your computer and use it in GitHub Desktop.
Ubuntu wxWidgets Install Command for asdf
#!/bin/bash
# asdf users will run into this problem when trying to use :observer.start(), because asdf erlang install doesn't include wxWdigets
## [error] ERROR: Could not find 'wxe_driver.so' in: /home/zsherbondy/.asdf/installs/erlang/25.1/lib/wx-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]}
## ]}}
# To resolve this problem, you need to properly compile and install wxWidgets as mentioned here: https://wiki.wxwidgets.org/Compiling_and_getting_started
# The following script is for Ubuntu, but the concept should be similar for other distros
## Install optional deps for wxWidgets so that build doesn't fail for webview and compat30
sudo apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev libgtk-3-dev openjdk-11-jdk
## Clone build, make, install
git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git \
&& cd wxWidgets \
&& git submodule update --init \
&& mkdir gtk-build-webview-compat && cd gtk-build-webview-compat \
&& ../configure --enable-webview --enable-compat30 \
# adjust the number based on how many CPUs you can / want to use for the build
&& sudo make -j6 \
&& sudo make install
# If it succeeds, you should be able to uninstall asdf using asdf uninstall erlang X.X, then reinstall using asdf install erlang X.X
# And, you will no longer get the error that wxWidgets will be unusable
# If you want to uninstall that compiled wxWidgets, and reinstall with different options, you can simply
# go to the build folder wxWidgets/gtk-build-webview-compat - run sudo make uninstall
# Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment