Skip to content

Instantly share code, notes, and snippets.

@oleksis
Last active October 21, 2023 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oleksis/0746bff4db6e2fc58c3bddf3f2672887 to your computer and use it in GitHub Desktop.
Save oleksis/0746bff4db6e2fc58c3bddf3f2672887 to your computer and use it in GitHub Desktop.
Compile wxPython 4.1.2a1 on openSUSE Tumbleweed

Compile wxPython from source on openSUSE Tumbleweed

Dev Tools

sudo zypper -n install -t pattern devel_basis
sudo zypper -n install gcc-c++ git wget

Requirement for build Python from source (Build dependencies)

sudo zypper -n install \
    readline-devel sqlite3-devel libbz2-devel \
    zlib-devel libopenssl-devel libffi-devel \
    ncurses-devel tk-devel ca-certificates gcc

Install wxPython 4 Dependencies

sudo zypper -n install \
    gtk3-devel gtk3-tools webkit2gtk3-devel \
    libjbig2 libjbig-devel libjpeg8 libjpeg8-devel \
    libpng16-16 libpng16-devel libtiff-devel \
    libSDL2-2_0-0 libSDL2-devel libSM6 libSM-devel\
    gstreamer gstreamer-devel gstreamer-plugins-base-devel \
    freeglut-devel libnotify4 libnotify-devel \
    libSM6 libSM-devel liblzma5 libXtst6 libXv1 \
    gdk-pixbuf-loader-rsvg gdk-pixbuf-query-loaders

Install Pyenv

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $HOME/.bashrc
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> $HOME/.bashrc
echo 'eval "$(pyenv init -)"' >> $HOME/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> $HOME/.bashrc
source $HOME/.bashrc

Custom Python build with --enable-shared

PYTHON_CONFIGURE_OPTS="--enable-shared" \
    pyenv install 3.8.12

pyenv shell 3.8.12

Add python-config to the PATH

PATH=$(pyenv root)/versions/${PYENV_VERSION}/bin:$PATH

Build wxPython from source

git clone https://github.com/wxWidgets/Phoenix

cd Phoenix

git submodule update --init --recursive

pip install -r requirements.txt

python build.py clean

python build.py dox etg --nodoc sip build_wx -v

Create simbolic link to build/wxbld/gtk3/lib64

ln -s lib build/wxbld/gtk3/lib64

Continue with build for Python

python build.py build_py -v

Create wheel

python setup.py bdist_wheel

Test wxPython

pip install dist/wxPython-4.1.2a1-cp38-cp38-linux_x86_64.whl
python -c "import wx; print(wx.version());"

Good Luck!

Links

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