Compile and Install Ubuntu: Difference between revisions
m (→Dependencies) |
(Complete restructure of page) |
||
Line 1: | Line 1: | ||
{{MoveToTrac}} | {{MoveToTrac}} | ||
The following instructions describe the compilation and installation of GRASS 6.x and its required dependencies completely from the source on Ubuntu based systems. Some things change fast and therefore it is expected that the instructions might fail. Please inform the grass-user list in case something just does not work (like for example non-available dependecies/packages from the repositories) or update the wiki respectively. | |||
== Important notes == | |||
* Pre-compiled packages and backports are available from [https://wiki.ubuntu.com/UbuntuGIS UbuntuGIS] via their [https://launchpad.net/~ubuntugis/+archive/ppa/ ppa.launchpad] repositories. This is by far the simplest and fastest solution. | |||
* 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. | |||
* GRASS version 6.5 exists for development purposes for testing features to-be backported to version 6.4. As such it may include unstable code and is not intended for end-users. | |||
* | |||
- | |||
* | * When installing a compiled code, instead of ''sudo make isntall'', the tool ''checkinstall'' can be used (e.g. ''sudo checkinstall'') which makes removal of packages easier. | ||
''' | |||
== Dependencies == | == Dependencies == | ||
* update the system from the repositories | |||
sudo apt-get update && sudo apt-get upgrade | sudo apt-get update && sudo apt-get upgrade | ||
Line 128: | Line 49: | ||
subversion | subversion | ||
* create a directory as a simple user where source code | * create a directory as a simple user where all source code is going to be stored (in this ''example'' a directory called '''src''' under '''/usr/local''' is used) | ||
sudo mkdir /usr/local/src | 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): | * 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 chown ''userid'':''groupid'' /usr/local/src | ||
Line 149: | Line 70: | ||
unzip proj-datumgrid-1.5.zip | unzip proj-datumgrid-1.5.zip | ||
* clean previous configuration & compilation | * if required, clean previous configuration & compilation | ||
make distclean | make distclean | ||
Line 158: | Line 79: | ||
== GEOS == | == GEOS == | ||
* download '''geos-3. | * download '''geos-3.2.2.tar.bz2''' from [http://trac.osgeo.org/geos/ http://trac.osgeo.org/geos], move to "source-code" directory and decompress | ||
bunzip geos-3. | bunzip geos-3.2.2.tar.bz2 | ||
tar xvf geos-3. | tar xvf geos-3.2.2.tar.bz2 | ||
* clean previous configuration & compilation | * if required, clean previous configuration & compilation | ||
make distclean | make distclean | ||
Line 174: | Line 95: | ||
== GDAL == | == GDAL == | ||
* | * GDAL must be compiled '''without''' GRASS support | ||
* download current stable version | * download current stable version | ||
svn checkout https://svn.osgeo.org/gdal/branches/1.7/gdal gdal | svn checkout https://svn.osgeo.org/gdal/branches/1.7/gdal gdal | ||
* enter in directory '''gdal_stable''' | * enter in directory '''gdal_stable''' | ||
cd /usr/local/src/gdal_stable | cd /usr/local/src/gdal_stable | ||
* optionally, update the source code | |||
svn up | svn up | ||
* clean previous configurations/compilations | * if required, clean previous configurations/compilations | ||
make distclean | make distclean | ||
Line 210: | Line 133: | ||
* compile & install & ldconfig | * compile & install & ldconfig | ||
make | make && sudo make install && sudo ldconfig | ||
== GRASS == | |||
Before attempting to compile GRASS read section (C) titled ''(C) COMPILATION NOTES for 64bit platforms'' within the ''INSTALL'' file (which is located in the main directory of GRASS source code). | |||
''' 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 | |||
''' Getting GRASS' source code ''' | ''' Getting GRASS' source code ''' | ||
* | * get current state of the 6.4.x release branch version (stable) | ||
svn checkout https://svn.osgeo.org/grass/grass/branches/releasebranch_6_4 grass64_release | |||
svn checkout https://svn.osgeo.org/grass/grass/ | |||
To download under development versions use: | |||
* for GRASS 6.5 (reminder: * ''GRASS version 6.5 exists for development purposes and is not intended for end-users'') | |||
svn checkout https://svn.osgeo.org/grass/grass/branches/develbranch_6 grass6_devel | |||
* for GRASS 7 | |||
svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk | |||
* for subsequent updates execute: | |||
svn up | |||
''' Configure, Compile and Install''' | |||
* if required, clean previous configuration & compilation | |||
make distclean | |||
* example configuration (which can/should be adjusted according to specific needs): | |||
CFLAGS="-g" ./configure \ | |||
--enable-debug \ | |||
--enable-64bit \ | |||
--with-libs=/usr/lib64 \ | |||
--with-cxx \ | |||
--with-readline \ | |||
--with-freetype=yes \ | |||
--with-freetype-includes="/usr/include/freetype2/" \ | |||
--enable-largefile=yes \ | |||
--with-proj-share=/usr/local/share/proj/ \ | |||
--with-geos=/usr/local/bin/geos-config \ | |||
--with-cairo \ | |||
--with-tcltk-includes="/usr/include/tcl8.4/" \ | |||
--with-wxwidgets \ | |||
--with-postgres=no \ | |||
--with-sqlite=yes \ | |||
--with-python=yes \ | |||
--with-opengl-libs=/usr/include/GL \ | |||
--with-ffmpeg=yes \ | |||
--with-ffmpeg-includes="/usr/include/libavcodec /usr/include/libavformat /usr/include/libswscale" | |||
* compile & install | |||
make -j2 && sudo make install && sudo ldconfig | |||
= Post compilation/installation control = | = Post compilation/installation control = | ||
* For a recommended quick-check read the [http://grass.osgeo.org/wiki/Compile_and_install_GRASS_and_QGIS_with_GDAL/OGR_Plugin#Troubleshooting Troubleshooting] section at [http://grass.osgeo.org/wiki/Compile_and_install_GDAL-GRASS_plugin Compile_and_install_GDAL-GRASS_plugin] | |||
* in case of errors in future compilation attempts, remember to remove program binaries and files created with the "configuration" from previous compilations with | * in case of errors in future compilation attempts, remember to remove program binaries and files created with the "configuration" from previous compilations with | ||
Line 228: | Line 207: | ||
* 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. | * 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. | ||
= Removal of GRASS = | = Removal of GRASS = | ||
Line 237: | Line 215: | ||
* /usr/local/bin/gem64 (file) | * /usr/local/bin/gem64 (file) | ||
* /home/username/.grassrc6 (file) | * /home/username/.grassrc6 (file) | ||
If needed, remove also the source code: | If needed, remove also the source code: |
Revision as of 04:29, 21 July 2010
The following instructions describe the compilation and installation of GRASS 6.x and its required dependencies completely from the source on Ubuntu based systems. Some things change fast and therefore it is expected that the instructions might fail. Please inform the grass-user list in case something just does not work (like for example non-available dependecies/packages from the repositories) or update the wiki respectively.
Important notes
- Pre-compiled packages and backports are available from UbuntuGIS via their ppa.launchpad repositories. This is by far the simplest and fastest solution.
- 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.
- GRASS version 6.5 exists for development purposes for testing features to-be backported to version 6.4. As such it may include unstable code and is not intended for end-users.
- When installing a compiled code, instead of sudo make isntall, the tool checkinstall can be used (e.g. sudo checkinstall) which makes removal of packages easier.
Dependencies
- update the system from the repositories
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 \ 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 \ ruby \ subversion
- create a directory as a simple user where all source code is 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.7.0.tar.gz and proj-datumgrid-1.5.zip from http://trac.osgeo.org/proj
- move proj-4.7.0.tar.gz to directory /usr/local/src and decompress
mv proj-4.7.0.tar.gz /usr/local/src tar xzvf proj-4.7.0.tar.gz
- move proj-datumgrid-1.5.tar.gz to proj/nad
mv proj-datumgrid-1.5.tar.gz /usr/local/src/proj/nad unzip proj-datumgrid-1.5.zip
- if required, clean previous configuration & compilation
make distclean
- simple configure, compile and install
./configure && make && sudo make install
GEOS
- download geos-3.2.2.tar.bz2 from http://trac.osgeo.org/geos, move to "source-code" directory and decompress
bunzip geos-3.2.2.tar.bz2 tar xvf geos-3.2.2.tar.bz2
- if required, 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
- GDAL must be compiled without GRASS support
- download current stable version
svn checkout https://svn.osgeo.org/gdal/branches/1.7/gdal gdal
- enter in directory gdal_stable
cd /usr/local/src/gdal_stable
- optionally, update the source code
svn up
- if required, 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
Before attempting to compile GRASS read section (C) titled (C) COMPILATION NOTES for 64bit platforms within the INSTALL file (which is located in the main directory of GRASS source code).
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
Getting GRASS' source code
- get current state of the 6.4.x release branch version (stable)
svn checkout https://svn.osgeo.org/grass/grass/branches/releasebranch_6_4 grass64_release
To download under development versions use:
- for GRASS 6.5 (reminder: * GRASS version 6.5 exists for development purposes and is not intended for end-users)
svn checkout https://svn.osgeo.org/grass/grass/branches/develbranch_6 grass6_devel
- for GRASS 7
svn checkout https://svn.osgeo.org/grass/grass/trunk grass_trunk
- for subsequent updates execute:
svn up
Configure, Compile and Install
- if required, clean previous configuration & compilation
make distclean
- example configuration (which can/should be adjusted according to specific needs):
CFLAGS="-g" ./configure \ --enable-debug \ --enable-64bit \ --with-libs=/usr/lib64 \ --with-cxx \ --with-readline \ --with-freetype=yes \ --with-freetype-includes="/usr/include/freetype2/" \ --enable-largefile=yes \ --with-proj-share=/usr/local/share/proj/ \ --with-geos=/usr/local/bin/geos-config \ --with-cairo \ --with-tcltk-includes="/usr/include/tcl8.4/" \ --with-wxwidgets \ --with-postgres=no \ --with-sqlite=yes \ --with-python=yes \ --with-opengl-libs=/usr/include/GL \ --with-ffmpeg=yes \ --with-ffmpeg-includes="/usr/include/libavcodec /usr/include/libavformat /usr/include/libswscale"
- compile & install
make -j2 && sudo make install && sudo ldconfig
Post compilation/installation control
- For a recommended quick-check read the Troubleshooting section at Compile_and_install_GDAL-GRASS_plugin
- 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.
Removal of GRASS
To get rid of a GRASS binaries installation, delete
- /usr/local/grass-6.4.0svn (folder, binaries location)
- /usr/local/bin/grass64 (file)
- /usr/local/bin/gem64 (file)
- /home/username/.grassrc6 (file)
If needed, remove also the source code:
- /usr/local/src/grass_64svn (folder, source code location)