Compile and Install Ubuntu
This page shall help to install the latest GRASS on Ubuntu based systems.
Current Release Branch (version 6.4.0)
The manual is based on Ubuntu 9.04.
- Pre-compiled packages and backports are available from UbuntuGIS via their ppa.launchpad repositories. (see the main binary download page) This is by far the simplest and fastest solution.
- If you simply want to build an updated version of GRASS or support libraries unmodified, in most cases it will be easier to use an automated build tool such as pbuilder, debuild, or cowbuilder. See the debian/ dir in the source code for details.
Dependencies
Preparation
sudo apt-get update && sudo apt-get upgrade
- install dependencies for compiling (in general) and dependencies for GRASS, PROJ, GDAL/OGR:
sudo apt-get install grass build-essential flex bison libncurses5-dev zlib1g-dev \ libjpeg62-dev libgdal1-dev libtiff4-dev libgcc1 tcl8.4-dev tk8.4-dev gettext \ fftw3-dev libfreetype6-dev libavcodec-dev libxmu-dev gdal-bin libgdal1-dev \ make python-dev python-wxversion libwxgtk2.8-dev swig libavutil-dev libavutil49
sudo apt-get build-dep grass
- install SQLite
sudo apt-get install sqlite3 libsqlite3-dev
- install SVN
sudo apt-get install subversion
- create a directory as a simple user where source code(s) are going to be stored (in our example we use a directory called src under /usr/local)
sudo mkdir /usr/local/src
- grant rwx (read-write-execute) permissions for our userid/ groupid on the directory (replace words userid and groupid with real userid):
sudo chown userid:groupid /usr/local/src
sudo chmod ug+rwx /usr/local/src
- download latest source code from GRASS SVN repository in a directory on the system (e.g. /usr/local/src)
cd /usr/local/src svn checkout https://svn.osgeo.org/grass/grass/branches/releasebranch_6_4 grass_64svn
- Above command places GRASS' source code in /usr/local/src/grass_64svn. In case of a subsequent update use the command: svn up from within the grass_64snv directory
Before attempting to compile GRASS, READ section (C) in the INSTALL file located in the main directory of GRASS source code entitled: (C) COMPILATION NOTES for 64bit platforms
go for GRASS!
- in our example we used the /usr/local/src directory to store GRASS' source code, so:
cd /usr/local/src/grass_64svn
- configuration:
CFLAGS="-g -Wall" ./configure \ --with-cxx --with-freetype=yes \ --with-postgres=no --with-sqlite=yes --enable-largefile=yes \ --with-tcltk-includes=/usr/include/tcl8.4 \ --with-freetype-includes=/usr/include/freetype2 \ --with-python=/usr/bin/python2.5-config \ --with-wxwidgets=yes \ --with-nls --enable-largefile \ --with-proj-share=/usr/share/proj
- compilation
make
- compilation is expected to end with a statement similar to the following:
Started compilation: Wed Feb 27 00:24:36 CET 2009 -- Errors in: No errors detected.
- installation
sudo checkinstall
- launch GRASS.6.4.svn
grass64
Notes
- in case of errors in future compilation attempts, remember to remove program binaries with
make clean
- and the files created with the "configuration" from previous compilations with
make distclean
Restricted Development Branch (version 6.5.0)
The following instructions concern the compilation and installation of the current 6.5.0 development branch version of GRASS 6 on Ubuntu based systems. The instructions were tested on Ubuntu Jaunty Jackalope 9.04/ 64-bit.
Dependencies
Preparation
sudo apt-get update && sudo apt-get upgrade
- install SQLite, SVN and dependencies for compiling PROJ, GEOS, GDAL/OGR, GRASS, GDAL-GRASS-PLUGIN:
sudo apt-get install \ build-essential \ make flex bison gcc libgcc1 g++ cmake ccache \ swig swig1.3 \ python python-dev python-qt4 python-qt4-dev \ sip4 python-sip4 python-sip4-dev python-opengl \ python-wxversion python-wxtools python-wxgtk2.8 \ libgsl0-dev \ wx2.8-headers wx-common libwxgtk2.8-dev libwxgtk2.8-dbg \ libwxbase2.8-dev libwxbase2.8-dbg \ ruby \ libncurses5-dev \ zlib1g-dev gettext \ libjpeg62-dev libtiff4-dev libpngwriter-dev \ libhdf4g-dev libhdf4g-run \ tcl8.4-dev tk8.4-dev \ libcairo libcairo-dev \ sqlite3 libsqlite3-dev \ libpq-dev \ libreadline5 libreadline5-dev libfreetype6-dev \ txt2tags \ fftw3 fftw3-dev \ libqt4-core libqt4-dbg libqt4-dev libqt4-gui libqt4-sql libqt4-qt3support \ lsb-qt4 qt4-designer qt4-dev-tools qt4-doc qt4-qtconfig \ libapt-pkg-perl resolvconf \ libjasper-dev \ subversion
- create a directory as a simple user where source code(s) are going to be stored (in this example a directory called src under /usr/local is used)
sudo mkdir /usr/local/src
- grant rwx (read-write-execute) permissions for our userid/ groupid on the directory (replace words userid and groupid with real userid):
sudo chown userid:groupid /usr/local/src sudo chmod ug+rwx /usr/local/src
PROJ4
- download proj-4.6.1.tar.gz and proj-datumgrid-1.4.zip from http://trac.osgeo.org/proj
- move proj-4.6.1.tar.gz to directory /usr/local/src and decompress
mv proj-4.6.1.tar.gz /usr/local/src tar xzvf proj-4.6.1.tar.gz
- move proj-datumgrid-1.4.tar.gz to proj/nad
mv proj-datumgrid-1.4.tar.gz /usr/local/src/proj/nad unzip proj-datumgrid-1.4.zip
- clean previous configuration & compilation
make distclean
- simple configure, compile and install
./configure && make && sudo make install
GEOS
- download geos-3.1.1.tar.bz2 from http://trac.osgeo.org/geos, move to "source-code" directory and decompress
bunzip geos-3.1.1.tar.bz2 tar xvf geos-3.1.1.tar.bz2
- clean previous configuration & compilation
make distclean
- simple configure, compile and install
./configure && make && sudo make install
- Ensure that /usr/local/lib is added to /etc/ld.so.conf and run /sbin/ldconfig afterwards
sudo ldconfig
GDAL
- Note: must compile without GRASS support
- download current stable version (skip this if code already available)
svn checkout https://svn.osgeo.org/gdal/branches/1.6/gdal gdal
- enter in directory gdal_stable (and, optionally, update the source code by executing svn up)
cd /usr/local/src/gdal_stable svn up
- clean previous configurations/compilations
make distclean
- configure
CFLAGS="-g -Wall" LDFLAGS="-s" ./configure \ --with-png=internal \ --with-libtiff=internal \ --with-geotiff=internal \ --with-jpeg=internal \ --with-gif=internal \ --with-ecw=yes \ --with-expat=yes \ --with-expat-inc=/usr/include/ \ --with-expat-lib=/usr/lib \ --with-sqlite3=yes \ --with-geos=yes \ --with-python \ --with-libz=internal \ --with-netcdf \ --with-sqlite \ --with-threads=yes \ --without-grass \ --without-ogdi \ --with-pg=/usr/bin/pg_config \ --with-xerces=yes
- compile & install & ldconfig
make && sudo make install && sudo ldconfig
GRASS
Getting GRASS' source code
- download current 6.5.0 development branch from GRASS SVN repository in a directory on the system (e.g. /usr/local/src)
svn checkout https://svn.osgeo.org/grass/grass/branches/develbranch_6 grass6_devel
- The above command places GRASS' source code in /usr/local/src/grass6_devel. In case of a subsequent update execute the command svn up from within the grass_trunk directory
- for latest development branch version of GRASS 7 and other versions follow instructions at Downloading GRASS Source
Before attempting to compile GRASS, READ section (C) in the INSTALL file located in the main directory of GRASS source code entitled: (C) COMPILATION NOTES for 64bit platforms
Suport for ffmpeg
- add extra dependencies to get ffmpeg support when compiling grass' source code under Ubuntu 64bit
sudo apt-get install \ ffmpeg ffmpeg2theora \ libffmpegthumbnailer-dev \ libavcodec-dev \ libxmu-dev \ libavformat-dev libswscale-dev
Suport for motif/lesstif (xganim)
- add extra dependencies to get motif/lesstif support when compiling grass' source code under Ubuntu 64bit
sudo apt-get install lesstif2-dev
go for GRASS!
- in our example we used the /usr/local/src directory to store GRASS' source code, so:
cd /usr/local/src/grass6_devel
- configuration
CFLAGS="-g" ./configure \ --enable-debug \ --enable-64bit \ --with-libs=/usr/lib64 \ --with-cxx \ --with-freetype=yes \ --with-freetype-includes="/usr/include/freetype2/" \ --with-postgres=no \ --with-sqlite=yes \ --enable-largefile=yes \ --with-tcltk-includes="/usr/include/tcl8.4/" \ --with-freetype-includes=/usr/include/freetype2 \ --with-opengl-libs=/usr/include/GL \ --with-readline \ --with-python=/usr/bin/python2.5-config \ --with-proj-share=/usr/local/share/proj/ \ --with-wxwidgets \ --with-cairo \ --with-ffmpeg=yes \ --with-ffmpeg-includes="/usr/include/libavcodec /usr/include/libavformat /usr/include/libswscale" \ --with-motif
- compilation
make
- installation
sudo make install && sudo ldconfig
GDAL-GRASS-PLUGIN
- get the plugin from http://download.osgeo.org/gdal gdal-grass-1.4.3.tar.gz
- create grass6.conf or add in ld.so.conf the GRASS library path
- clean previous configurations/compilations
make distclean
- configure (change to grass_trunk if compiling against GRASS version 7)
./configure \ --prefix=/usr/local \ --with-gdal=/usr/local/bin/gdal-config \ --with-grass=/usr/local/grass-6.5.svn/ \ --with-autoload="/usr/local/lib/gdalplugins/" \ --with-ld-shared="g++ -shared"
- compile & install
make && sudo make install
- launch GRASS
grass65
Post compilation/installation control
- in case of errors in future compilation attempts, remember to remove program binaries and files created with the "configuration" from previous compilations with
make distclean
- another common mistake is compiling a module against some GRASS version and then try to run it through another GRASS version. The solution is to recompile the affected module or, in case there are multiple GRASS installations, set up properly LD_LIBRARY_PATH paths.
- for a (recommended) quick-check read the Troubleshooting section found at Compile_and_install_GDAL-GRASS_plugin