Compile and Install: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(use reasonable page title)
(→‎Ubuntu 6.06: checkinstall for Ubuntu added)
Line 133: Line 133:


* [http://david.p.finlayson.googlepages.com/makegrass.sh makegrass.sh] is script designed to automate most of the download, configuration and compilation of GRASS 6.x-CVS
* [http://david.p.finlayson.googlepages.com/makegrass.sh makegrass.sh] is script designed to automate most of the download, configuration and compilation of GRASS 6.x-CVS
** it is advised use [https://help.ubuntu.com/community/CheckInstall checkinstall] (''sudo apt-get install checkinstall'') instead of ''make install'' to keep track of installed software
* [[User:Steko/Automated_CVS_compiling|Here]] is another of these scripts, it's homemade so probably you'll find the above more useful for production sites.
* [[User:Steko/Automated_CVS_compiling|Here]] is another of these scripts, it's homemade so probably you'll find the above more useful for production sites.



Revision as of 11:10, 31 May 2007

How to do compilation and installation of GRASS 6?

Here we explain the procedure to compile GRASS from CVS, but it also applies to official GRASS 6 releases.

For installation of precompiled binary packages, see the main Installation Guide.

For detailed information on compilation, please see the INSTALL file in the source code.

Prerequisites

GRASS needs at least two extra libraries: PROJ and GDAL/OGR

Note: if you want to have DBMS support in GDAL (subsequently in GRASS) you have to perform the "Optional" steps below as well.

  • PROJ4 for management of projections (with proj-datumgrid-1.3.zip support)
  • Optional: GEOS
  • Optional: PostgreSQL, mySQL, unixODBC, SQLite (SQLite is needed for QGIS)
  • GDAL/OGR for reading and writing various GIS data formats (interoperability)

You have to install these two libraries first.

It is easiest to obtain a prepackaged version of these libraries (e.g., .rpm; .deb) for your particular operating system and run the corresponding package installation (e.g., rpm -Uhv packagename.rpm; apt-get) in a terminal window. Take care to also install the development packages of these libraries (...-devel packages). If there is no prepackage version, then you will have to download the source code (see links above, source code packages usually ends in .tar.gz or .zip) and compile it (you must have a C compiler installed as part of your operating system). The Web sites show the steps to compile the libraries.


Other libraries needed to run GRASS are listed here: REQUIREMENTS. To compile, you will also need the respective "-devel" packages.

Generic Compilation and installation procedure

  • checkout the grass6 module from cvs (read http://grass.itc.it/faq/cvs_howto.html grass CVS howto instructions)
  • It is wise that compilation processes are carried out as a normal user: If you want to get the source code in a place where you do not have write permissions (e.g. in /usr/local/src/cvs) just follow this:
     cd /usr/local/src/cvs 
     su -c 'mkdir grass6'
     su -c 'chown yourlogin:yourgroup grass6'
  • do a checkout (co) of the repository
     cvs -z3 co grass6
  • in the grass6 directory, you will find the precious INSTALL file, open it with your favourite pager/editor and read it carefully!
  • run configure with parameters to adapt the compile process to your own system. To see what options can be passed to it, run configure --help. The minimum set of configure parameters is (refers to GRASS 6 from CVS, not to 6.x release):
     ./configure ### It may (!) look like this:
     ./configure \
         --with-cxx \
         --with-sqlite \
         --with-postgres-libs=/usr/include/pgsql/libpq \
         --with-postgres-includes=/usr/include/pgsql \
         --with-freetype \
         --with-freetype-includes=/usr/include/freetype2 \
         --with-motif \
         --with-glw \
         --with-proj-share=/usr/share/proj

You may have to explicitly state the path for certain packages (i.e., gdal). The Unix 'locate' command will come in handy for finding the path of the package you need (you may have to run locate as root ex: sudo locate gdal-config).

Please note that the paths mentioned may widely vary due to the distribution used. At the end of configuration process you should get report not much different from this:

GRASS is now configured for: i686-pc-linux-gnu

Source directory:            /usr/src/grass6
Build directory:             /usr/src/grass6
Installation directory:      /usr/local/grass-6.1.cvs
Startup script in directory: ${exec_prefix}/bin
C compiler:                  gcc -g -O2 
C++ compiler:                c++ -g -O2
FORTRAN compiler:            
Building shared libraries:   yes
64bit support:               no

 NVIZ:                       yes

 BLAS support:               no
 C++ support:                yes
 DWG support:                no
 FFMPEG support:             no
 FFTW support:               yes
 FreeType support:           yes
 GDAL support:               yes
 GLw support:                no
 JPEG support:               yes
 LAPACK support:             no
 Large File Support (LFS):   no
 Motif support:              no
 MySQL support:              no
 NLS support:                no
 ODBC support:               no
 OGR support:                yes
 OpenGL(R) support:          yes
 PNG support:                yes
 PostgreSQL support:         yes
 Readline support:           no
 SQLite support:             no
 Tcl/Tk support:             yes
 TIFF support:               yes
 X11 support:                yes
 
  • Let's compile it (takes a little while...)!
     make
  • At the end, you should get report not much different from this:
----------------------------------------------------------------------
Following modules are missing the 'description.html' file in src code:
----------------------------------------------------------------------
GRASS GIS compilation log
-------------------------
Started compilation: Ne kvě 28 13:18:43 CEST 2006
--
Errors in:
--
Finished compilation: Ne kvě 28 13:43:40 CEST 2006
(In case of errors please change into the directory with error and run 'make')
  • If there is any error, change directory to directory with error and run "make" again. Report occuring bug to grass mailing list
  • Once the installation process is finished, you're ready to install GRASS system wide.
     su -c 'make install'
  • enjoy GRASS:
     grass61

What else?

If you want to use QGIS, then also compile the GRASS-GDAL/OGR plugin. This is also useful to access your GRASS-data from other application using GDAL/OGR like thuban.

Platform Specific Notes

Debian

     # first install PROJ, then GDAL.
     cd grass63/
     fakeroot buildpackage

Ubuntu 6.06

  • makegrass.sh is script designed to automate most of the download, configuration and compilation of GRASS 6.x-CVS
    • it is advised use checkinstall (sudo apt-get install checkinstall) instead of make install to keep track of installed software
  • Here is another of these scripts, it's homemade so probably you'll find the above more useful for production sites.

RPM SPEC files

... can be found in the source code, rpm/ directory, or here

MS-Windows/Cygwin

... see here (should be moved to the Wiki)

MS-Windows/native

See also WinGRASS Current Status for latest updates.

For this, you need MinGW and MSys, including gcc, g++, binutils, flex, bison, make, and pdcurses, all from: http://www.mingw.org/download.shtml

You also need this version of the XDR library: http://wiki.qgis.org/qgiswiki/BuildingWindowsBinaryOnLinux?action=AttachFile&do=get&target=xdr-4.0-mingw2.tar.gz

The above is a stripped-down version of the Sun RPC library, which only includes the XDR [de]serialisation code, with the networking code removed.

You will first need to build and install zlib, PNG, PROJ, GDAL and the above XDR library. Then, building GRASS is similar to building it on Linux, except that you need to disable most of the optional features (including the use of shared libraries).

Aside: it might encourage more people to work on the Windows version if the GRASS site contained binary versions of the necessary libraries. Having to build XDR, PROJ, GDAL, zlib, PNG, Tcl/Tk and possibly other stuff from source before you can start to compile GRASS is a major nuisance.

... or see here incl. QGIS compilation (with MinGW)

Mac OSX

... see here for instructions

... or this other way

Zaurus

... see here for instructions


Common problems and solutions

During compilation, error can occur if certain packages are not installed. Here a list of problems with solution:

  • error: X11/Xlib.h: No such file or directory
    • this suggests that you don't have the X headers installed
    • Solution: Install the libx11-dev package

Configure options and their meanings

For configure there are many options and some GRASS modules are built only if some options are set. Here are listed common configuration options with short explanation.

  • --prefix=/path - Sets path where GRASS will be installed. GRASS will reside in /path/grass-version.
  • --enable-largefile - Enables large (>2Gb on 32bit systems) support. For current large file support status look at Large File Support page.
  • --with-cxx - Enables compilation of C++ code. Required for r.terraflow module.
  • --with-readline - Enables readline support. If readline is enabled, you can use its history/editing facilities when entering r.mapcalc expressions on stdin.
  • --with-glw - Enables GLw support. The GLw library provides OpenGL "canvas" widgets for Athena and Motif.
That switch is unnecessary for normal compilation. It's only
required for r3.showdspf, which isn't normally built; if you 
want it, you have build it manually 
(e.g. "make -C raster3d/r3.showdspf").
As similar functionality is now provided by NVIZ, r3.showdspf
is deprecated.
r3.showdspf uses the Motif widget (so you also need a 
Motif library, e.g. Lesstif or OpenMotif).
Glynn Clements at GRASS-user mailing list