INSTALL 9.2 KB

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