Difference between revisions of "Build PyCEGUI from source for Linux"

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search
(Ubuntu 11.10)
(Changes the dist-packages hack to be safer, in case the user has files installed in site-packages. Then, just to be even more paranoid, we still only use rmdir, in case the mv failed.)
Line 7: Line 7:
 
* Obtain a copy of CEGUI [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.7.5.tar.gz?download here]
 
* Obtain a copy of CEGUI [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.7.5.tar.gz?download here]
 
* Extract to a folder
 
* Extract to a folder
* Before we build, we have to symlink the site-packages directory correctly, so it installs to the correct place.  
+
* 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 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
 
  sudo ln -s /usr/local/lib/python2.6/dist-packages/ /usr/local/lib/python2.6/site-packages
Line 19: Line 22:
 
* Obtain a copy of CEGUI [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.7.5.tar.gz?download here]
 
* Obtain a copy of CEGUI [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.7.5.tar.gz?download here]
 
* Extract to a folder
 
* Extract to a folder
* Before we build, we have to symlink the site-packages directory correctly, so it installs to the correct place.  
+
* Before we build, we have to symlink the site-packages directory correctly, so it installs to the correct place.
  sudo rmdir /usr/local/lib/python2.7/site-packages
+
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
 
  sudo ln -s /usr/local/lib/python2.7/dist-packages/ /usr/local/lib/python2.7/site-packages
  

Revision as of 02:24, 7 January 2012

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:

ptrdif_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 --- 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

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>