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

From CEGUI Wiki - Crazy Eddie's GUI System (Open Source)
Jump to: navigation, search
(made python version the same across code snippets)
(Updated instructions for ubuntu 11.10, including required patches, and python 2.7 support.)
Line 1: Line 1:
 
{{VersionBadge|0.7}} {{VersionAtLeast|0.7.4}}
 
{{VersionBadge|0.7}} {{VersionAtLeast|0.7.4}}
= Ubuntu 11.04 =
+
= 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.
 
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: <code>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</code>
 
* Install dependency packages: <code>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</code>
 
* 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]
Line 12: Line 13:
 
  ./configure && make && sudo make install && sudo ldconfig
 
  ./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:''
 
* ''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.6
+
  export CXXFLAGS=-I/usr/include/python2.7
 +
./configure && make && sudo make install && sudo ldconfig
 +
== Ubuntu 11.10 ==
 +
* Install dependency packages: <code>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</code>
 +
* Obtain a copy of CEGUI [http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.7.5.tar.gz?download here]
 +
* Extract to a folder
 +
* 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
 +
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'''
 +
<code>
 +
--- 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
 +
</code>
 +
 
 +
'''python27.patch'''
 +
<code>
 +
--- 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
 +
</code>
 +
 
 +
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 && make && sudo make install && sudo ldconfig
 
  ./configure && make && sudo make install && sudo ldconfig
  

Revision as of 18:36, 6 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.
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.
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 && make && sudo make install && sudo ldconfig

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>