Skip to content

SUMO compilation

Stefania Pedrazzi edited this page May 5, 2022 · 20 revisions

This page explains how to recompile the SUMO dependency on every platforms. SUMO is an open source microscopic and continuous road traffic simulation package used by the sumo interface to generate traffic in any Webots simulation.

Get Sumo 1.13 from precompiled package and create the target package: https://sourceforge.net/projects/sumo/files/sumo

Linux

Reference: http://sumo.dlr.de/wiki/Installing

Ubuntu 22.04

# Recommended: sudo apt-get autoremove libxerces-c3.2 libxerces-c-dev libfox-1.6-0 libfox-1.6-dev
sudo add-apt-repository ppa:sumo/stable
sudo apt-get update
sudo apt-get install sumo sumo-tools

cd $HOME/software
mkdir sumo-1.13-Ubuntu_22.04
cd sumo-1.13-Ubuntu_22.04

cp /usr/bin/duarouter .
cp /usr/bin/netconvert .
cp /usr/bin/netedit .
cp /usr/bin/sumo .
cp /usr/bin/sumo-gui .


# other dependencies
cp /usr/bin/activitygen bin/
cp /usr/bin/dfrouter bin/
cp /usr/bin/emissionsDrivingCycle bin/
cp /usr/bin/emissionsMap bin/
cp /usr/bin/jtrrouter bin/
cp /usr/bin/marouter bin/
cp /usr/bin/netgenerate bin/
cp /usr/bin/od2trips bin/
cp /usr/bin/polyconvert bin/

mkdir tools
cp -R /usr/share/sumo/tools/traci tools/
cp -R /usr/share/sumo/tools/sumolib tools/
cp /usr/share/sumo/tools/randomTrips.py tools/

mkdir data
cp -R /usr/share/sumo/data/3D data/
cp -R /usr/share/sumo/data/emissions data/
cp -R /usr/share/sumo/data/typemap data/
cp -R /usr/share/sumo/data/xsd data/

sudo apt-get autoremove sumo sumo-tools

cd $HOME/software
tar -cvjSf sumo-1.13-Ubuntu_22.04.tar.bz2 sumo-1.13-Ubuntu_22.04

Mac

Reference: http://sumo.dlr.de/wiki/Installing/MacOS_Build_w_Homebrew

Download Sumo sources (sumo-src-0.30.0.tar.gz) in $HOME/software/sumo-0.30.0 from:

https://sourceforge.net/projects/sumo/files/sumo/version%200.30.0/

cd $HOME/software/sumo-0.30.0

brew update
brew install Caskroom/cask/xquartz
brew install gdal
brew install proj
brew install xerces-c
brew install homebrew/x11/fox
brew uninstall --ignore-dependencies  python # python is a dependency of gdal, we prefer to use the Python of the system

export CPPFLAGS="$CPPFLAGS -I/opt/X11/include/"
export LDFLAGS="-L/opt/X11/lib"
./configure CXX=clang++ --with-xerces=/usr/local --with-proj-gdal=/usr/local
make -jX

mkdir sumo-0.30-mac
cp -r bin sumo-0.30-mac/bin
cp -r data sumo-0.30-mac/data

mkdir sumo-0.30-mac/tools

cp -r tools/traci sumo-0.30-mac/tools/traci
cp -r tools/sumolib sumo-0.30-mac/tools/sumolib 
cp tools/randomTrips.py sumo-0.30-mac/tools
cp tools/route2trips.py sumo-0.30-mac/tools

# find dependencies: otool -L duarouter netedit netconvert sumo sumo-gui | grep /usr/local | sed -e 's/ (.*//;s/^\s*//' | sort | uniq
cp /usr/local/opt/fox/lib/libFOX-1.6.0.dylib sumo-0.30-mac/bin
cp /usr/local/opt/freetype/lib/libfreetype.6.dylib sumo-0.30-mac/bin
cp /usr/local/opt/jpeg/lib/libjpeg.9.dylib sumo-0.30-mac/bin
cp /usr/local/opt/libpng/lib/libpng16.16.dylib sumo-0.30-mac/bin
cp /usr/local/opt/libtiff/lib/libtiff.5.dylib sumo-0.30-mac/bin
cp /usr/local/opt/proj/lib/libproj.12.dylib sumo-0.30-mac/bin
cp /usr/local/opt/xerces-c/lib/libxerces-c-3.1.dylib sumo-0.30-mac/bin
cp /usr/local/opt/gdal/lib/libgdal.1.dylib sumo-0.30-mac/bin
cp /usr/local/opt/json-c/lib/libjson-c.2.dylib sumo-0.30-mac/bin
cp /usr/local/opt/freexl/lib/libfreexl.1.dylib sumo-0.30-mac/bin
cp /usr/local/opt/geos/lib/libgeos_c.1.dylib sumo-0.30-mac/bin
cp /usr/local/opt/giflib/lib/libgif.7.dylib sumo-0.30-mac/bin
cp /usr/local/opt/libgeotiff/lib/libgeotiff.2.dylib sumo-0.30-mac/bin
cp /usr/local/opt/libspatialite/lib/libspatialite.7.dylib sumo-0.30-mac/bin
cp /usr/local/opt/sqlite/lib/libsqlite3.0.dylib sumo-0.30-mac/bin
cp /usr/local/opt/pcre/lib/libpcre.1.dylib sumo-0.30-mac/bin
cp /usr/local/opt/libxml2/lib/libxml2.2.dylib sumo-0.30-mac/bin
cp /usr/local/opt/liblwgeom/lib/liblwgeom-2.1.5.dylib sumo-0.30-mac/bin
cp /usr/local/Cellar/geos/3.6.2/lib/libgeos-3.6.2.dylib sumo-0.30-mac/bin
chmod u+w sumo-0.30-mac/bin/*dylib*

# create deps.py as described bellow
cd sumo-0.30-mac/bin
python deps.py

cd ../..
tar -czvf sumo-0.30-mac.tar.gz sumo-0.30-mac
# File: deps.py
from subprocess import call
import os

executables = [
    "sumo",
    "sumo-gui",
    "netconvert",
    "netedit",
    "duarouter"
]

libraries = [
    "/usr/local/opt/fox/lib/libFOX-1.6.0.dylib",
    "/usr/local/opt/freetype/lib/libfreetype.6.dylib",
    "/usr/local/opt/jpeg/lib/libjpeg.9.dylib",
    "/usr/local/opt/libpng/lib/libpng16.16.dylib",
    "/usr/local/opt/libtiff/lib/libtiff.5.dylib",
    "/usr/local/opt/proj/lib/libproj.12.dylib",
    "/usr/local/opt/xerces-c/lib/libxerces-c-3.1.dylib",
    "/usr/local/opt/gdal/lib/libgdal.1.dylib",
    "/usr/local/opt/json-c/lib/libjson-c.2.dylib",
    "/usr/local/opt/freexl/lib/libfreexl.1.dylib",
    "/usr/local/opt/geos/lib/libgeos_c.1.dylib",
    "/usr/local/opt/giflib/lib/libgif.7.dylib",
    "/usr/local/opt/libgeotiff/lib/libgeotiff.2.dylib",
    "/usr/local/opt/libspatialite/lib/libspatialite.7.dylib",
    "/usr/local/opt/sqlite/lib/libsqlite3.0.dylib",
    "/usr/local/opt/pcre/lib/libpcre.1.dylib",
    "/usr/local/opt/libxml2/lib/libxml2.2.dylib",
    "/usr/local/opt/liblwgeom/lib/liblwgeom-2.1.5.dylib",
    "/usr/local/Cellar/geos/3.6.2/lib/libgeos-3.6.2.dylib"
]

def command(cmd):
    print cmd
    call(cmd.split())

for lA in libraries:
    lAName = os.path.basename(lA)
    command("install_name_tool -id @loader_path/%s %s" % (lAName, lAName))
    for lB in libraries:
        lBName = os.path.basename(lB)
        command("install_name_tool -change %s @loader_path/%s %s" % (lB, lBName, lAName))

for executable in executables:
    for l in libraries:
        lName = os.path.basename(l)
        command("install_name_tool -change %s @loader_path/%s %s" % (l, lName, executable))

Windows

Download Sumo windows 64bits precompiled package (sumo-win64-0.30.0.zip) and extract it in $HOME/software/sumo-0.30.0 from:

https://sourceforge.net/projects/sumo/files/sumo/version%200.30.0/

cd $HOME/software/sumo-win64-0.30.0/sumo-0.30.0
mkdir sumo-0.30-windows

cp -r bin sumo-0.30-windows/bin
cp -r data sumo-0.30-windows/data

mkdir sumo-0.30-windows/tools

cp -r tools/traci sumo-0.30-windows/tools/traci
cp -r tools/sumolib sumo-0.30-windows/tools/sumolib 
cp tools/randomTrips.py sumo-0.30-windows/tools
cp tools/route2trips.py sumo-0.30-windows/tools

zip -r sumo-0.30-windows.zip sumo-0.30-windows

Finally upload the file on the ftp.

Clone this wiki locally