![]() |
Building VPython on SuSE |
![]() |
First install Python and Numeric.
Then carry out the following steps to update the GNU C++ compiler, build the Boost libraries, and compile VPython. These steps are necessary because the latest version of the Boost libraries is required by VPython.
UPDATE THE GNU COMPILER
You need to install an update to the GNU compiler because version 3.3.1 available
on SuSE 9.0 has a serious bug that prevents the compilation of VPython based
on Boost, and SuSE says they will not provide an update (somehow they feel that
the fact that a program won't compile isn't very serious!).
1) Download the G++ 3.3.3 package from one of the mirror sites listed at gcc.gnu.org.
Make sure you get the full package.
2) Untar the source: `tar xjf gcc-3.3.3.tar.bz2` or `tar xzf gcc-3.3.3.tar.gz`
as appropriate.
3) Make a new directory alongside the unpacked source tree (e.g. 'mkdir buildgcc'),
and enter that directory.
4) Issue the following command:
../gcc-3.3.3/configure --prefix=/usr/local --enable-languages=c,c++ --enable-version-specific-runtime-libs
--program-suffix=-3.3.3 --enable-threads=posix
This configures the compiler to install under /usr/local (the default), building
only the C and C++ compilers, renaming every generated program with the suffix
'-3.3.3' appended to the name (to prevent stomping on your default compiler),
enabling thread support for POSIX threads (should be automatically detected,
but this is for safety), and installing the libraries in a location that won't
stomp all over the default libs.
5) Build the package with `make bootstrap`. This will take a while.
6) Become root (su root) and install the package with `make install`.
Now, (assuming that /usr/local/bin is in your PATH) you can configure the compilation
of VPython by setting the CXX environment variable to g++-3.3.3 (see below for
more details).
BUILD THE BOOST LIBRARIES
Next, you need to install the Boost 1.31 libraries, which makes it possible
for the Visual module to communicate with Python (Boost 1.30 packaged with SuSE
9.0 isn't adequate for our purposes).
1) Download the Boost source from www.boost.org.
2) Untar the source: `tar xjf boost_1_31_0.tar.bz2` or `tar xzf boost_1_31_0.tar.gz`
as appropriate.
3) Build Boost with the following options:
bjam -sTOOLS=gcc -sGXX=g++-3.3.3 -sGCC=gcc-3.3.3
-sPYTHON_VERSION=2.3 stage
4) When done, become root (su root) and repeat the above command, replacing
'stage' with 'install'.
5) Also while root create the following links, which make the Boost libraries
findable in a standard location:
ln -s libboost_python-gcc-mt-1_31.so /usr/local/lib/libboost_python.so
ln -s boost-1_31/boost/ /usr/local/include/boost
COMPILE VPYTHON
With an updated GNU compiler and the Boost libraries installed you can now compile
VPython. In order to invoke the correct version of gcc, you need to set the
environment variable CXX=g++-3.3.3. Also, because gtkglarea.h is in a nonstandard
location on SuSE (/opt/gnome/include/gtkgl), you need to set CPPFLAGS.
CPPFLAGS=-I/opt/gnome/include
CXX=g++-3.3.3 ./configure (plus any other options
such as --prefix)
With this version of VPython if you type 'vpython' it starts up IDLE in the
demo directory. If instead you type 'vpython test.py' it opens IDLE with this
file (it creates the file if necessary).
[VPython home page]