INSTALL 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. INSTALL GRASS from source code
  2. ------------------------------
  3. Please read *all* text below.
  4. Table of contents
  5. PREREQUISITES
  6. (A) SOURCE CODE DISTRIBUTION
  7. (B) COMPILATION
  8. (C) COMPILATION NOTES for 64bit platforms
  9. (D) INSTALLATION (first time)
  10. (E) INSTALLATION ON MACOSX
  11. (F) RUNNING GRASS
  12. (G) UPDATE OF SOURCE CODE (SVN or SVN snapshot only)
  13. (H) COMPILING INDIVIDUAL MODULES - OWN MODULES
  14. (I) CODE OPTIMIZATION
  15. (J) DEBUGGING OPTIONS
  16. (K) LARGE FILE SUPPORT (for raster maps)
  17. (L) SUPPORT
  18. (M) GRASS PROGRAMMER'S MANUAL
  19. (N) CONTRIBUTING CODE AND PATCHES
  20. (O) DRAFT TUTORIAL
  21. PREREQUISITES
  22. The install order matters. GRASS needs at least two libraries
  23. which have to be installed before installing/compiling GRASS:
  24. For links to the software, see ./REQUIREMENTS.html in this
  25. directory:
  26. Installation order:
  27. 1. PROJ4
  28. 2. GDAL-OGR (compiled without GRASS support)
  29. 3. optionally: databases such as PostgreSQL, MySQL, sqlite
  30. 4. GRASS
  31. 5. optionally: GDAL-OGR-GRASS plugin
  32. (A) SOURCE CODE DISTRIBUTION
  33. GRASS source code is currently distributed in 2 forms:
  34. 1) Officially released source code (e.g. grass-7.0.0.tar.gz or later)
  35. The Full source code version contains all the GRASS source code
  36. required for compilation. It is distributed as one file (*.tar.gz
  37. package) and the version is composed of 3 numbers, e.g. 7.0.0, 7.0.1
  38. etc.
  39. 2) SVN or SVN Snapshots of source code (SVN or SVN snapshot)
  40. This version of the source code can be acquired either from the SVN
  41. repository (http://svn.osgeo.org/grass/) or as a snapshot
  42. (*.tar.gz package) of that SVN repository. The SVN snapshot name
  43. contains the date when the snapshot was created (checked out from
  44. the SVN repository), e.g. grass-7.0.svn_src_snapshot_2008_10_19.tar.gz
  45. Further instructions at http://trac.osgeo.org/grass/wiki/DownloadSource
  46. (B) COMPILATION
  47. IMPORTANT: All unix distributions are different.
  48. For Solaris, see hint below.
  49. The command,
  50. ./configure --help
  51. explains the options used to disable the compilation of non-mandatory
  52. GRASS modules. See REQUIREMENTS.html for details.
  53. First step of the compilation (-g for debugging, or -O2 for optimization):
  54. CFLAGS="-g -Wall" ./configure
  55. Explanation of make targets:
  56. make install - installs the binary
  57. make bindist - make a binary package with install script
  58. make srcdist - make a source package for distribution
  59. make srclibsdist - make a source package for library distribution
  60. make libs - make libraries only
  61. make clean - delete all files created by 'make'
  62. make distclean - 'make clean' + delete all files created by './configure'
  63. make libsclean - clean libraries compiled by 'make libs'
  64. make htmldocs - generate programmer's documentation as HTML files
  65. make packagehtmldocs - package programmer's documentation in HTML
  66. make pdfdocs - generate programmer's documentation as PDF files
  67. Next step is the compilation itself:
  68. make
  69. Note for Solaris users:
  70. To configure GRASS correctly on a system which doesn't have a suitable
  71. install program (AC_PROG_INSTALL ignores versions which are known to
  72. have problems), you need to ensure that $srcdir is an absolute path,
  73. by using e.g.:
  74. `pwd`/configure ...
  75. or:
  76. ./configure --srcdir=`pwd` ...
  77. Then proceed as described above.
  78. Note for using a different compiler:
  79. By setting environment variables, the compiler
  80. names can be defined (C and C++):
  81. CC=cc CPP=cpp ./configure ...
  82. (C) COMPILATION NOTES for 64bit platforms
  83. To successfully compile GRASS on 64bit platforms, the required
  84. FFTW2 library has to be compiled with -fPIC flag:
  85. #this applies to FFTW2, not GRASS:
  86. cd fftw-2.1.5/
  87. CFLAGS="-fPIC" ./configure
  88. make
  89. make install
  90. To fully enable 64bit library usage for GRASS on 64bit platforms,
  91. the following additional parameters are recommended/required:
  92. ./configure \
  93. --enable-64bit \
  94. --with-libs=/usr/lib64 \
  95. ...
  96. See also CODE OPTIMIZATION below.
  97. (D) INSTALLATION (first time)
  98. After compilation, the resulting code is stored in the directory
  99. ./dist.$ARCH
  100. and the scripts (grass70, ...) in
  101. ./bin.$ARCH
  102. To run GRASS, simply start
  103. ./bin.$ARCH/grass70
  104. or run
  105. make install
  106. grass70
  107. (E) INSTALLATION ON MACOSX
  108. See the ReadMe.rtf in the ./macosx/ folder.
  109. (F) RUNNING GRASS
  110. Download a sample data package from the GRASS web site, see
  111. http://grass.osgeo.org/download/data.php
  112. Extract the data set and point "database" in the
  113. GRASS startup menu to the directory.
  114. Enjoy.
  115. (G) UPDATE OF SOURCE CODE (SVN or SVN snapshot only)
  116. Assuming that you want to update your current installation from
  117. SVN, you have to perform a few steps. In general:
  118. - update from SVN
  119. - configure, compile
  120. In detail:
  121. cd /where/your/grass7sourcecode/lives/
  122. svn update
  123. ./configure ...
  124. make
  125. make install
  126. (H) COMPILING INDIVIDUAL MODULES - OWN MODULES
  127. To compile (self-made) GRASS modules or to compile modified modules
  128. at least the GRASS libraries have to be compiled locally. This is
  129. done by launching:
  130. make libs
  131. Then change into the module's directory and launch the "make"
  132. command. The installation can be either done with "make install" from
  133. the main source code directory or locally with
  134. "INST_NOW=y make"
  135. You may want to define an alias for this:
  136. alias gmake7='INST_NOW=y make'
  137. Then simply compile/install the current module with
  138. gmake7
  139. Note: If you keep your module source code outside the standard GRASS
  140. source code directory structure, you will have to change the relative
  141. path(s) in the Makefile to absolute path(s).
  142. (I) CODE OPTIMIZATION
  143. If you would like to set compiler optimisations, for a possibly faster
  144. binary, type (don't enter a ";" anywhere):
  145. CFLAGS=-O ./configure
  146. or,
  147. setenv CFLAGS -O
  148. ./configure
  149. whichever works on your shell. Use -O2 instead of -O if your compiler
  150. supports this (note: O is the letter, not zero). Using the "gcc" compiler,
  151. you can also specify processor specific flags (examples, please suggest
  152. better settings to us):
  153. CFLAGS="-mcpu=athlon -O2" # AMD Athlon processor with code optimisations
  154. CFLAGS="-mcpu=pentium" # Intel Pentium processor
  155. CFLAGS="-mcpu=pentium4" # Intel Pentium4 processor
  156. CFLAGS="-O2 -msse -msse2 -mfpmath=sse -minline-all-stringops" # Intel XEON 64bit processor
  157. CFLAGS="-mtune=nocona -m64 -minline-all-stringops" # Intel Pentium 64bit processor
  158. To find out optional CFLAGS for your platform, enter:
  159. gcc -dumpspecs
  160. See also: http://gcc.gnu.org/
  161. A real fast GRASS version (and small binaries) will be created with
  162. LDFLAGS set to "stripping" (but this disables debugging):
  163. CFLAGS="-O2 -mcpu=<cpu_see_above> -Wall" LDFLAGS="-s" ./configure
  164. (J) DEBUGGING OPTIONS
  165. The LDFLAGS="" part must be undefined as "-s" will strip the debugging
  166. information.
  167. Don't use -O for CFLAGS if you want to be able to step through function
  168. bodies. When optimisation is enabled, the compiler will re-order statements
  169. and re-arrange expressions, resulting in object code which barely resembles
  170. the source code.
  171. The -g and -Wall compiler flags are often useful for assisting debugging:
  172. CFLAGS="-g -Wall" ./configure
  173. See also the file
  174. ./doc/debugging.txt
  175. (K) LARGE FILE SUPPORT (for raster maps)
  176. GRASS >= 7.0 includes improved support for reading and writing large files
  177. (> 2GB) if it is possible in your operating system. If you compile with
  178. configure [...] --enable-largefile
  179. you should be able to have raster and vector maps which are larger than 2GB.
  180. Individual programs may or may not work with large files - please report.
  181. (L) SUPPORT
  182. Note that this code is still actively being developed and errors inevitably
  183. turn up. If you find a bug, please report it to the GRASS bug tracking system
  184. so we can fix it. See http://grass.osgeo.org/bugtracking/index.php
  185. If you are interested in helping to develop GRASS, please join the GRASS
  186. developers mailing list. See http://grass.osgeo.org/devel/index.php
  187. (M) GRASS PROGRAMMER'S MANUAL
  188. The Programmer's manual is generated with doxygen from the source code.
  189. Please see the README file and the files at:
  190. http://grass.osgeo.org/programming7/
  191. (N) CONTRIBUTING CODE AND PATCHES
  192. Please see ./SUBMITTING, ./SUBMITTING_DOCS, ./SUBMITTING_PYTHON,
  193. and ./SUBMITTING_SCRIPTS in this directory.
  194. (O) DRAFT TUTORIAL
  195. http://grass.osgeo.org/wiki/GRASS_6_Tutorial
  196. ------------------
  197. (C) 1999-2010 by The GRASS Development Team
  198. $Date$