Skip to content

Instantly share code, notes, and snippets.

@pemd-sys
Last active May 23, 2024 12:44
Show Gist options
  • Save pemd-sys/6aed397bcbdb380cb53bc09183f3a8f4 to your computer and use it in GitHub Desktop.
Save pemd-sys/6aed397bcbdb380cb53bc09183f3a8f4 to your computer and use it in GitHub Desktop.
Installing wxWidgets

Installing wxWidgets on Ubuntu

The latest download and install instructions are available in
https://docs.wxwidgets.org/3.1/plat_gtk_install.html
The wiki is a bit old so try following the above and consult the wiki for more details. BUT, follow the steps as per the docs NOT the wiki.
https://wiki.wxwidgets.org/Compiling_and_getting_started

However sometimes specially for new linux users it can become overwhelming and installation process can throw funny errors. So I have created a step by step process to hopefully help you compile wxwidgets. Enjoy :-)

Installing pre-requisites

sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install mesa-utils
sudo apt-get install freeglut3-dev
sudo apt-get install -y libjpeg-dev
sudo apt-get install liblzma-dev

Download latest release file from github

curl -LJO https://github.com/wxWidgets/wxWidgets/releases/download/v3.0.5/wxWidgets-3.0.5.tar.bz2

Unpack and configure for compilation

tar -xvf wxWidgets-3.0.5.tar.bz2 -C wxWidgets
cd wxWidgets-3.0.5/
mkdir gtk-build
cd gtk-build
../configure  --with-gtk=3 --with-opengl

--with-opengl allows for use of opengl with wxwidgets

Output from configure

  Installation directory:             /usr/local
  Documentation directory:            ${prefix}/share/doc/tiff-4.0.3
  C compiler:                         gcc -g -O2 -Wall -W
  C++ compiler:                       g++ -g -O2
  Enable runtime linker paths:        no
  Enable linker symbol versioning:    no
  Support Microsoft Document Imaging: yes
  Use win32 IO:                       no

 Support for internal codecs:
  CCITT Group 3 & 4 algorithms:       yes
  Macintosh PackBits algorithm:       yes
  LZW algorithm:                      yes
  ThunderScan 4-bit RLE algorithm:    yes
  NeXT 2-bit RLE algorithm:           yes
  LogLuv high dynamic range encoding: yes

 Support for external codecs:
  ZLIB support:                       yes
  Pixar log-format algorithm:         yes
  JPEG support:                       yes
  Old JPEG support:                   yes
  JPEG 8/12 bit dual mode:            no
  ISO JBIG support:                   no
  LZMA2 support:                      yes

  C++ support:                        yes

  OpenGL support:                     yes


Configured wxWidgets 3.0.5 for `x86_64-pc-linux-gnu'

  Which GUI toolkit should wxWidgets use?                 GTK+ 3 with support for GTK+ printing libnotify
  Should wxWidgets be compiled into single library?       no
  Should wxWidgets be linked as a shared library?         yes
  Should wxWidgets support Unicode?                       yes (using wchar_t)
  What level of wxWidgets compatibility should be enabled?
                                       wxWidgets 2.6      no
                                       wxWidgets 2.8      yes
  Which libraries should wxWidgets use?
                                       STL                no
                                       jpeg               sys
                                       png                sys
                                       regex              builtin
                                       tiff               builtin
                                       zlib               sys
                                       expat              sys
                                       libmspack          no
                                       sdl                no

Make Sources

make -j3 

install wxwidgets

sudo make install

install library

On some systems you need to rebuild the library cache and make sure your new library is found everywhere in the system. Its a bit like registering a DLL in Windows. Its required on Ubuntu.

sudo ldconfig

Test installation

wx-config --list
wx-config --version             // e.g. yields "3.0.5"

Test by building samples

cd samples/minimal            // assumes you are still in gtk-build directory
make
./minimal

Clean install folder

Cleaning the build folder will remove the build intermediates and so you wont be able to say re-make the samples inside the gtk-build directory.

make clean
@HaIIucination
Copy link

Thankyouuuu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment