LinuxBuild
From sumo
This document describes how to build SUMO and all (higher level) libraries it depends on from scratch under Linux. That is, there is no need for package management (RPM or such) or root access. All you need is a working gcc (version 3.3 and up should suffice) and probably some basic libraries Fox depends on.
It has been tested successfully on several SuSE Linux installations and with a recent cygwin. Everything which needs extra work on cygwin is described in the cygwin section.
- First check whether your Linux distribution comes with a xerces-c package and install it together with the header files (for SuSE users this is the -dev package). Version 3.0 is used for the current SVN version. You should also check whether Proj, GDAL and Fox already come with your distribution and (if so) install them together with the header files (devel packages). Every package installed this way you will not need to build by yourself.
- Second download the sources of SUMO, Proj, GDAL, Fox (if you want a GUI), and Xerces-C (if it does not come with your distribution).
- If you are building a fresh repository checkout and don't need precise geocoordinates you can leave out Proj and GDAL.
We use the GNU autotools for generating configure and Makefiles for Unix-like environments. Documentation can be found in the
Contents |
The Libraries
- Build and install the libraries (if you don't have root access choose a different target for the libs and includes such as $HOME). For GDAL, Fox and Proj this is more or less straightforward:
tar xzf fox-1.6.36.tar.gz cd fox-1.6.36 ./configure --prefix=$HOME && make install cd .. tar xzf gdal-1.5.1.tar.gz cd gdal-1.5.1 ./configure --prefix=$HOME && make install cd .. tar xzf proj-4.6.0.tar.gz cd proj-4.6.0 ./configure --prefix=$HOME && make install
- Note: The make install for gdal may fail due to the Python bindings which it wants to install into some only-root-writable directory. You can safely ignore this.
- It is strongly recommended to use a user writable installation directory and do "make install" instead of trying to specify directories inside the directory trees of gdal, proj and fox when building Sumo later on.
- Note: It seems like some distributions of FOX are built with disabled openGl-support. If you get unresolved references to methods such as "glColor...", "glVertex3f...", etc. during compilation of guisim you have to enable openGL-support before compiling the FOX-library using "./configure --with-opengl=yes --prefix=$HOME && make install"; Still, this is the default normally.
- In contrast to the other libraries, it is very likely that Xerces-C also comes with your Linux distribution (at least it does with a recent SUSE). If so, please try first install it from there and do not forget to install the developer package as well.
- The Xerces build is somewhat more involved:
tar xzf xerces-c-current.tar.gz
export XERCESCROOT=${HOME}/xerces-c-src_3_0_1
cd $XERCESCROOT/src/xercesc
autoconf
./runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread -P$HOME
make
make install
Building a release
tar xzf sumo-src-<version>.tar.gz cd sumo-<version>/ ./configure --with-fox=$HOME --with-proj-gdal=$HOME --with-xerces=$HOME --prefix=$HOME make install
For all packages which were installed into default locations (because you used your package manager and did not build them yourself), you can leave out the "--with-*" reference.
For additional options to configure (for instance if you need to specify some non-standard lib and include paths for any of the libraries) please see
./configure --help
Building from subversion repository
The process is essentially the same as building a release except that one needs the GNU autotools (which were also necessary when building xerces). The following commands are needed:
svn co https://sumo.svn.sourceforge.net/svnroot/sumo/trunk/sumo make -f Makefile.cvs ./configure --with-fox=$HOME --with-proj-gdal=$HOME --with-xerces=$HOME --prefix=$HOME make make install
The call to the autotools is hidden in Makefile.cvs.
If you do not need precise conversion of geocoordinates and use a recent svn checkout you can leave out download and compilation of Proj and GDAL and of course you do not need to specify --with-proj-gdal then.
Cygwin
Cygwin comes with a quite old xerces-c (version 2.5). After installing it you need to make a symbolic link in /usr/lib such that the linker finds the correct library:
cd /usr/lib; ln -s /usr/lib/libxerces-c25.dll.a /usr/lib/libxerces-c.dll.a
Now everything (but the GUI) should build fine.
At the moment GUI building is still troublesome. It depends whether you want to use the X-Server or native Windows GUI. We tried native Windows GUI only and had to change the installed libFOX-1.4.la such that it contains
dependency_libs=' -lgdi32 -lglaux -ldl -lcomctl32 -lwsock32 -lwinspool -lmpr -lpthread -lpng /usr/lib/libtiff.la /usr/lib/libjpeg.la -lz -lbz2 -lopengl32 -lglu32'
Your mileage may vary.
Troubleshooting
Unresolved references to openGL-functions
Build reports unresolved references to openGL-functions, saying things such as
"./utils/glutils/libglutils.a(GLHelper.o): In function `GLHelper::drawOutlineCircle(float, float, int, float, float)': /home/smartie/sumo-0.9.5/src/utils/glutils/GLHelper.cpp:352: undefined reference to `glEnd'"
SUMO needs FOX-toolkit to be build with openGL-support enabled. Do this by compiling FOX-toolkit as following:
tar xzf fox-1.4.34.tar.gz cd fox-1.4.34 ./configure --with-opengl=yes --prefix=$HOME && make install
Further comment from Michael Behrisch ([sumo-user], 4.4.2007): Probably there is something wrong with your OpenGL installation. Make sure you have the libGL.so and libGLU.so which are most likely symbolic links to libGL.so.1.2 or something like this. They should appear in /usr/lib and case does matter (so "libgl.so" won't do).
Trouble with SVN r4182
Just wanted to drop a short note that I was only able to build r4182 after removing l.472 from src/Makefile:
@@ -469,7 +469,6 @@ $(sumo_LDADD) \ ./utils/glutils/libglutils.a \ ./gui/GUIManipulator.o \ -./utils/gui/drawer/GUICompleteSchemeStorage.o \ -l$(LIB_FOX)
Problems with the socket subsystem
Problem:
recv ./foreign/tcpip/libtcpip.a(socket.o) (symbol belongs to implicit dependency /usr/lib/libsocket.so.1)
Solution: http://lists.danga.com/pipermail/memcached/2005-September/001611.html
Building on Ubuntu 8.04 "Hardy Heron"
On Ubuntu 8.10 "Intrepid Ibex", the following packages are needed to build SUMO:
sudo apt-get install libtool libgdal1-dev proj libxerces27-dev
For building the SUMO GUI, the following additional packages are needed:
sudo apt-get install libfox1.4-dev libgl1-mesa-dev libglu1-mesa-dev
Ubuntu 8.04 does not ship with libgdal.so, but only with libgdal1.4.0.so.1, so you either need to create a symlink /usr/lib/libgdal.so -> /usr/lib/libgdal1.4.0.so.1
sudo ln -s /usr/lib/libgdal1.4.0.so.1 /usr/lib/libgdal.so
or if you are using the SVN version, you can instead patch the configure.ac file to look for libgdal1.4.0.so.1 instead by changing LIB_GDAL="gdal" to LIB_GDAL="gdal1.4.0" and running make -f Makefile.cvs to re-generate the configure script.
Then the following configure line should prepare the Makefiles for building...
./configure --with-fox-includes=/usr/include/fox-1.4 --with-gdal-includes=/usr/include/gdal --with-proj-libraries=/usr --with-gdal-libraries=/usr --with-proj-gdal --enable-traci --enable-internal-lanes --enable-debug
...and you can build the binaries by just invoking
make install
Note: The binaries are placed under /usr/bin/ directory.
Building on Ubuntu 8.10 "Intrepid Ibex"
On Ubuntu 8.10 "Intrepid Ibex", the following packages are needed to build SUMO:
sudo apt-get install libtool libgdal1-dev proj libxerces-c2-dev
For building the SUMO GUI, the following additional packages are needed:
sudo apt-get install libfox1.4-dev libgl1-mesa-dev libglu1-mesa-dev
Ubuntu 8.10 does not ship with libgdal.so, but only with libgdal1.5.0.so, so you either need to create a symlink /usr/lib/libgdal.so -> /usr/lib/libgdal1.5.0.so, or if you are using the SVN version, you can instead patch the configure.ac file to look for libgdal1.5.0.so instead by changing LIB_GDAL="gdal" to LIB_GDAL="gdal1.5.0" and running make -f Makefile.cvs to re-generate the configure script.
Then the following configure line should prepare the Makefiles for building...
./configure --with-fox-includes=/usr/include/fox-1.4 --with-gdal-includes=/usr/include/gdal --with-proj-libraries=/usr --with-gdal-libraries=/usr --with-proj-gdal --enable-traci --enable-internal-lanes --enable-debug
...and you can build the binaries by just invoking
make
Building Ubuntu 9.04 "Jaunty Jackalope"
For Ubuntu 9.04 "Jaunty Jackalope", follow the build instructions above for Ubuntu 8.10.
Building Ubuntu 9.10 "Karmic Koala"
For Ubuntu 9.10 follow the instructions für Ubuntu 8.10 with one exception:
Instead of libfox1.4-dev install libfox-1.6-dev (don't miss the additional dash '-'):
sudo apt-get install libfox-1.6-dev libgl1-mesa-dev libglu1-mesa-dev
