Build PyCEGUI from source for Linux

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search

Written for CEGUI 0.7


Works with versions 0.7.x (obsolete)

Requires at least version
0.7.4

Ubuntu Flavors

Version shipped in repositories is 0.6.0 (as of 7th July 2011) so if we want 0.7.x we need to build it from source.

Ubuntu 11.04

  • Install dependency packages: sudo apt-get install build-essential pkg-config python-dev libfreetype6-dev libpcre3-dev libboost-python-dev libglut3-dev libpng-dev libmng-dev libjpeg-dev libfreeimage-dev
  • Obtain a copy of CEGUI here
  • Extract to a folder
  • Before we build, we have to symlink the site-packages directory correctly, so it installs to the correct place.

First, we move the contents of site-packages to dist-packages.

sudo mv /usr/local/lib/python2.6/site-packages/* /usr/local/lib/python2.6/dist-packages/

Now, we remove site-packages, and symlink it to dist-packages

sudo rmdir /usr/local/lib/python2.6/site-packages
sudo ln -s /usr/local/lib/python2.6/dist-packages/ /usr/local/lib/python2.6/site-packages
  • Build CEGUI with python support
./configure && make && sudo make install && sudo ldconfig
  • Note: On some Ubuntu systems it seems that CEGUI's configure system does not correctly detect the Python headers. To solve this, do the following:
export CXXFLAGS=-I/usr/include/python2.7
./configure && make && sudo make install && sudo ldconfig

Ubuntu 11.10

  • Install dependency packages: sudo apt-get install build-essential pkg-config python-dev libfreetype6-dev libpcre3-dev libboost-python-dev libpng-dev libmng-dev libjpeg-dev libfreeimage-dev libtool autoconf
  • Obtain a copy of CEGUI here
  • Extract to a folder
  • Before we build, we have to symlink the site-packages directory correctly, so it installs to the correct place.

First, we move the contents of site-packages to dist-packages.

sudo mv /usr/local/lib/python2.7/site-packages/* /usr/local/lib/python2.7/dist-packages/

Now, we remove site-packages, and symlink it to dist-packages

sudo rmdir /usr/local/lib/python2.7/site-packages 
sudo ln -s /usr/local/lib/python2.7/dist-packages/ /usr/local/lib/python2.7/site-packages
  • Patch CEGUI:

There are two patched required to make CEGUI 0.7.5 compile correctly with python support, on 11.10. They are:

ptrdiff_t.patch --- cegui/include/CEGUIString.h 2011-05-11 13:36:22.091872287 -0500 +++ cegui/include/CEGUIString.h.new 2011-05-11 13:38:04.387704592 -0500 @@ -34,6 +34,7 @@

#include <string>
#include <string.h>
#include <stdexcept>

+#include <cstddef>

// Start of CEGUI namespace section
namespace CEGUI

python27.patch --- acinclude.m4 2011-02-18 14:31:36.736126680 -0600 +++ src/CEGUI-0.7.5/acinclude.m4 2011-02-18 14:47:26.379459922 -0600 @@ -1394,7 +1394,7 @@

AC_DEFUN([AX_PYTHON],
[AC_MSG_CHECKING(for python build information)
AC_MSG_RESULT([])

-for python in python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python; do +for python in python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2 python; do

AC_CHECK_PROGS(PYTHON_BIN, [$python])
ax_python_bin=$PYTHON_BIN
if test x$ax_python_bin != x; then

Copy the contents of the code blocks above, and paste them into files of the correct name (ptrdiff_t.patch and python27.patch respectively). Then apply the patched like so:

$ patch -p0 < ptrdiff_t.patch
$ patch -p0 < python27.patch
  • Regenerate configure:
$ ./bootstrap
  • Build CEGUI with python support
./configure --disable-external-tinyxml && make && sudo make install && sudo ldconfig

Note: The tinyXML shipping with Ubuntu 11.10 is too new, and doesn't compile, hence we disable it.

Still not working?

You can try running your program with:

PYTHONPATH="/usr/local/lib/python2.6/site-packages:$PYTHONPATH" python <file.py>

Note for Panda3D users You can run your program at the same way, using:

PYTHONPATH="/usr/local/lib/python2.6/site-packages:$PYTHONPATH" ppython <file.py>