INSTALL 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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
  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 GIS 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 GIS
  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.4.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.2.0, 7.2.1
  38. etc.
  39. 2) Snapshots of source code (generated from GitHub)
  40. This version of the source code can be acquired either from the GitHub
  41. repository (https://github.com/OSGeo/grass/) or as a auto-generated snapshot
  42. (*.tar.gz package) of the GitHub repository. The snapshot name
  43. contains the date when the snapshot was created (checked out from
  44. the GitHub repository), e.g. grass-7.4.git_src_snapshot_2019_06_11.tar.gz
  45. from https://grass.osgeo.org/grass74/source/snapshot/
  46. Further instructions at https://trac.osgeo.org/grass/wiki/DownloadSource
  47. (B) COMPILATION
  48. IMPORTANT: All Unix based distributions are different.
  49. For Solaris, see hints below.
  50. The command,
  51. ./configure --help
  52. explains the options used to disable the compilation of non-mandatory
  53. GRASS modules. See REQUIREMENTS.html for details.
  54. First step of the compilation (-g for debugging, or -O2 for optimization):
  55. CFLAGS="-g -Wall" ./configure
  56. Explanation of make targets:
  57. make install - installs the binary
  58. make bindist - make a binary package with install script
  59. make srcdist - make a source package for distribution
  60. make srclibsdist - make a source package for library distribution
  61. make libs - make libraries only
  62. make clean - delete all files created by 'make'
  63. make distclean - 'make clean' + delete all files created by './configure'
  64. make libsclean - clean libraries compiled by 'make libs'
  65. make htmldocs - generate programmer's documentation as HTML files
  66. make packagehtmldocs - package programmer's documentation in HTML
  67. make pdfdocs - generate programmer's documentation as PDF files
  68. Next step is the compilation itself:
  69. make
  70. Detailed Wiki notes for various operating systems (MS-Windows, GNU/Linux distros,
  71. FreeBSD, AIX, etc) are available at:
  72. https://grasswiki.osgeo.org/wiki/Compile_and_Install
  73. Note for Solaris users (see also Wiki page above):
  74. To configure GRASS correctly on a system which doesn't have a suitable
  75. install program (AC_PROG_INSTALL ignores versions which are known to
  76. have problems), you need to ensure that $srcdir is an absolute path,
  77. by using e.g.:
  78. `pwd`/configure ...
  79. or:
  80. ./configure --srcdir=`pwd` ...
  81. Then proceed as described above.
  82. Note when using a compiler different from "gcc":
  83. By setting environment variables, the compiler
  84. names can be defined (C and C++):
  85. CC=cc CPP=cpp ./configure ...
  86. (C) COMPILATION NOTES for 64bit platforms
  87. To successfully compile GRASS on 64bit platforms, the required
  88. FFTW2 library has to be compiled with -fPIC flag:
  89. #this applies to FFTW3, not to GRASS GIS:
  90. cd fftw-3.3.4/
  91. CFLAGS="-fPIC" ./configure
  92. make
  93. make install
  94. To fully enable 64bit library usage for GRASS on 64bit platforms,
  95. the following additional parameters are recommended/required:
  96. ./configure \
  97. --enable-64bit \
  98. --with-libs=/usr/lib64 \
  99. ...
  100. See also CODE OPTIMIZATION below.
  101. (D) INSTALLATION (first time)
  102. After compilation, the resulting code is stored in the directory
  103. ./dist.$ARCH
  104. and the scripts (grass74, ...) in
  105. ./bin.$ARCH
  106. To run GRASS, simply start
  107. ./bin.$ARCH/grass74
  108. or run
  109. make install
  110. grass74
  111. (E) INSTALLATION ON MACOSX
  112. See the ReadMe.rtf in the ./macosx/ folder and the Wiki page above.
  113. (F) RUNNING GRASS GIS
  114. Download a sample data package from the GRASS web site, see
  115. https://grass.osgeo.org/download/sample-data/
  116. Extract the data set and point the "Database" field in the
  117. GRASS GIS startup menu to the extracted directory.
  118. Enjoy.
  119. (G) UPDATE OF SOURCE CODE
  120. Assuming that you want to update your current installation from
  121. GitHub, you have to perform a few steps. In general:
  122. - update from GitHub
  123. - configure, compile
  124. In detail:
  125. cd /where/your/grass7sourcecode/lives/
  126. git fetch --all
  127. git merge upstream/master
  128. ./configure ...
  129. make
  130. make install
  131. For details, see https://trac.osgeo.org/grass/wiki/HowToGit
  132. (H) COMPILING INDIVIDUAL MODULES - OWN MODULES
  133. To compile (self-made) GRASS modules or to compile modified modules
  134. at least the GRASS libraries have to be compiled locally. This is
  135. done by launching:
  136. make libs
  137. Then change into the module's directory and launch the "make"
  138. command. The installation can be either done with "make install" from
  139. the main source code directory or locally with
  140. "INST_NOW=y make"
  141. You may want to define an alias for this:
  142. alias gmake7='INST_NOW=y make'
  143. Then simply compile/install the current module with
  144. gmake7
  145. Note: If you keep your module source code outside the standard GRASS
  146. source code directory structure, you will have to change the relative
  147. path(s) in the Makefile to absolute path(s).
  148. (I) CODE OPTIMIZATION
  149. If you would like to set compiler optimisations, for a possibly faster
  150. binary, type (don't enter a ";" anywhere):
  151. CFLAGS=-O ./configure
  152. or,
  153. setenv CFLAGS -O
  154. ./configure
  155. whichever works on your shell. Use -O2 instead of -O if your compiler
  156. supports this (note: O is the letter, not zero). Using the "gcc" compiler,
  157. you can also specify processor specific flags (examples, please suggest
  158. better settings to us):
  159. CFLAGS="-mcpu=athlon -O2" # AMD Athlon processor with code optimisations
  160. CFLAGS="-mcpu=pentium" # Intel Pentium processor
  161. CFLAGS="-mcpu=pentium4" # Intel Pentium4 processor
  162. CFLAGS="-O2 -msse -msse2 -mfpmath=sse -minline-all-stringops" # Intel XEON 64bit processor
  163. CFLAGS="-mtune=nocona -m64 -minline-all-stringops" # Intel Pentium 64bit processor
  164. Note: As of version 4.3.0, GCC offers the -march=native switch that
  165. enables CPU auto-detection and automatically selects optimizations supported
  166. by the local machine at GCC runtime including -mtune.
  167. To find out optional CFLAGS for your platform, enter:
  168. gcc -dumpspecs
  169. See also: http://gcc.gnu.org/
  170. A real fast GRASS version (and small binaries) will be created with
  171. LDFLAGS set to "stripping" (but this disables debugging):
  172. CFLAGS="-O2 -mcpu=<cpu_see_above> -Wall" LDFLAGS="-s" ./configure
  173. (J) DEBUGGING OPTIONS
  174. The LDFLAGS="" part must be undefined as "-s" will strip the debugging
  175. information.
  176. Don't use -O for CFLAGS if you want to be able to step through function
  177. bodies. When optimisation is enabled, the compiler will re-order statements
  178. and re-arrange expressions, resulting in object code which barely resembles
  179. the source code.
  180. The -g and -Wall compiler flags are often useful for assisting debugging:
  181. CFLAGS="-g -Wall" ./configure
  182. See also the file ./doc/debugging.txt and the Wiki page
  183. https://grasswiki.osgeo.org/wiki/GRASS_Debugging
  184. (K) LARGE FILE SUPPORT (for raster maps)
  185. GRASS >= 7.0.0 includes improved support for reading and writing large files
  186. (> 2GB) if it is possible in your operating system. If you compile with
  187. configure [...] --enable-largefile
  188. you should be able to have raster and vector maps which are larger than 2GB.
  189. While most code has been updated, individual programs may not yet work with
  190. large files - please report.
  191. See also
  192. https://grasswiki.osgeo.org/wiki/GRASS_GIS_Performance
  193. https://grasswiki.osgeo.org/wiki/Software_requirements_specification
  194. (L) SUPPORT
  195. Note that this code is still actively being developed and errors inevitably
  196. turn up. If you find a bug, please report it to the GRASS bug tracking system
  197. so we can fix it. See https://grass.osgeo.org/development/bug-tracking/
  198. If you are interested in helping to develop GRASS, please join the GRASS
  199. developers mailing list. See https://grass.osgeo.org/development/
  200. (M) GRASS PROGRAMMER'S MANUAL
  201. The Programmer's manual is generated with doxygen from the source code.
  202. Please see the README file and the files at:
  203. https://grass.osgeo.org/programming7/
  204. (N) CONTRIBUTING CODE AND PATCHES
  205. Please see ./SUBMITTING in this directory, or better,
  206. https://trac.osgeo.org/grass/wiki/Submitting
  207. (O) DRAFT TUTORIAL
  208. https://grass.osgeo.org/documentation/first-time-users/
  209. ------------------
  210. (C) 1999-2019 by The GRASS Development Team
  211. Last changed: $Date$