Compile and Install: Difference between revisions
⚠️AnneGhisla (talk | contribs) (added more info on Python scripts installation) |
(Attempt to cleanup this page incl. removing outdated stuff) |
||
(244 intermediate revisions by 33 users not shown) | |||
Line 1: | Line 1: | ||
{{MoveToTrac}} | <!-- {{MoveToTrac}} --> | ||
Here we explain the procedure to compile GRASS from | '''Disclaimer''': This page explains how to turn the GRASS source code into an installable binary package ("compilation") for different operating systems. If you just want to get ready-to-use binaries, go [https://grass.osgeo.org/download/ here], otherwise read on... | ||
== How to do compilation and installation of GRASS? == | |||
Here we explain the procedure to compile GRASS from GitHub, but it also applies to official GRASS 8 releases. | |||
''For installation of precompiled binary packages, see the main [[Installation Guide]].'' | ''For installation of precompiled binary packages, see the main [[Installation Guide]].'' | ||
For detailed information on compilation, please see the [ | For detailed information on compilation, please see the [https://github.com/OSGeo/grass/blob/main/INSTALL.md INSTALL] file in the source code. | ||
=== Prerequisites === | === Prerequisites === | ||
GRASS needs at least two extra libraries: PROJ and GDAL/OGR | ==== Extra libraries ==== | ||
GRASS needs at least two extra libraries: PROJ and GDAL/OGR. It is recommended to download them as ready-to-use packages for your software platform (Linux distribution, Windows, Mac...). | |||
Other libraries needed to run GRASS are listed on the [https://github.com/OSGeo/grass/blob/main/REQUIREMENTS.md requirements page]. | |||
To compile, you will also need the respective "-devel" packages; see below for details. | |||
==== Download GRASS source code ==== | |||
First, [https://grass.osgeo.org/download/ download the GRASS source code]. | |||
=== Generic Compilation and installation procedure === | === Generic Compilation and installation procedure === | ||
* 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 | * 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/) just follow this: | ||
cd /usr/local/src/ | cd /usr/local/src/ | ||
su -c 'mkdir | su -c 'mkdir grass8' | ||
su -c 'chown yourlogin:yourgroup | su -c 'chown yourlogin:yourgroup grass8' | ||
Otherwise if you have permissions just continue as a normal user: | Otherwise if you have permissions just continue as a normal user: | ||
cd | mkdir $HOME/src | ||
cd $HOME/src/ | |||
git clone https://github.com/OSGeo/grass.git grass_main | |||
* | * 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 | less | |||
<!-- The minimum set of configure parameters is | <!-- The minimum set of configure parameters is | ||
./configure ### --> | ./configure ### --> | ||
Line 52: | Line 47: | ||
--with-cxx \ | --with-cxx \ | ||
--with-sqlite \ | --with-sqlite \ | ||
--with- | --with-python \ | ||
--with- | --with-geos \ | ||
--with-gdal=/usr/bin/gdal-config \ | |||
--with-cairo --with-cairo-ldflags=-lfontconfig \ | |||
--with-freetype \ | --with-freetype \ | ||
--with-freetype-includes=/usr/include/freetype2 \ | --with-freetype-includes=/usr/include/freetype2 \ | ||
--with- | --with-proj --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). | 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). | ||
Line 71: | Line 67: | ||
At the end of configuration process you should get report not much different from this: | At the end of configuration process you should get report not much different from this: | ||
GRASS is now configured for: | GRASS is now configured for: x86_64-pc-linux-gnu | ||
Source directory: /home/user/software/grass_main | |||
Build directory: /home/user/software/grass_main | |||
Installation directory: ${prefix}/grass84 | |||
Startup script in directory:${exec_prefix}/bin | |||
C compiler: gcc -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color | |||
C++ compiler: c++ -g -Wall | |||
Building shared libraries: yes | |||
OpenGL platform: X11 | |||
MacOSX application: no | |||
MacOSX architectures: | |||
MacOSX SDK: | |||
BLAS support: no | |||
BLAS support: yes | |||
BZIP2 support: no | |||
C++ support: yes | C++ support: yes | ||
Cairo support: yes | |||
DWG support: no | DWG support: no | ||
FFTW support: yes | FFTW support: yes | ||
FreeType support: yes | FreeType support: yes | ||
GDAL support: yes | GDAL support: yes | ||
GEOS support: yes | |||
[...] | |||
* Let's compile it (takes a little while...)! | * Let's compile it (takes a little while...)! | ||
make | make -j2 | ||
* At the end, you should get report not much different from this: | * At the end, you should get report not much different from this: | ||
---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ||
Following modules are missing the 'description.html' file in src code: | Following modules are missing the 'description.html' file in src code: | ||
---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ||
GRASS | GRASS compilation log | ||
------------------------- | ------------------------- | ||
Started compilation: | Started compilation: Mon 19 Aug 2024 10:47:57 PM CEST | ||
-- | -- | ||
Errors in: | Errors in: | ||
No errors detected. | |||
-- | -- | ||
Finished compilation: | Finished compilation: Mon 19 Aug 2024 10:55:12 PM CEST | ||
(In case of errors please change into the directory with error and run 'make') | (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 | * If there is any error, change directory to directory with error and run "make" again. Report occurring bug to GRASS mailing list | ||
* Once the installation process is finished, you're ready to install GRASS system wide. | * Once the installation process is finished, you're ready to install GRASS system wide. | ||
su -c 'make install' | su -c 'make install' | ||
* enjoy GRASS: | * enjoy GRASS: | ||
grass | |||
=== What else? === | === What else? === | ||
If you want to use [ | If you want to use [https://www.qgis.org 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 [ | from other application using GDAL/OGR like [[R_statistics/ R]]. | ||
* [[Compile and install GRASS and QGIS with GDAL/OGR Plugin]] (enables QGIS to read GRASS data directly) | * [[Compile and install GRASS and QGIS with GDAL/OGR Plugin]] (enables QGIS to read GRASS data directly) | ||
=== Compile and install GDAL-GRASS plugin === | |||
* See [[Compile and install GDAL-GRASS plugin]] | |||
=== Platform Specific Notes === | === Platform Specific Notes === | ||
==== Linux ==== | ==== Linux ==== | ||
Linux comes in various flavours, i.e. distributions. | |||
===== Distribution related packaging ===== | |||
Examples: | |||
* Archlinux: https://aur.archlinux.org/packages/grass | |||
* Centos: https://src.fedoraproject.org/rpms/grass | |||
* Debian: https://trac.osgeo.org/grass/wiki/DebianUbuntuPackaging | |||
* EPEL: https://src.fedoraproject.org/rpms/grass | |||
* Fedora: https://src.fedoraproject.org/rpms/grass | |||
* Ubuntu: https://trac.osgeo.org/grass/wiki/DebianUbuntuPackaging | |||
===== Alpine Linux ===== | |||
<source lang="bash"> | |||
# install compiler tools and libraries | |||
apk add build-base bzip2-dev cairo-dev fftw-dev freetype-dev g++ gcc gdal-dev geos-dev git \ | |||
gnutls-dev libc6-compat libjpeg-turbo-dev libpng-dev make openjpeg-dev openblas-dev \ | |||
postgresql-dev proj-dev python3-dev py3-numpy-dev sqlite-dev tar tiff-dev unzip vim \ | |||
wget zip zstd-dev | |||
# install needed tools and libraries when using GRASS | |||
apk add attr bash bison bzip2 cairo curl fftw flex freetype gdal gdal-tools gettext geos gnutls \ | |||
jsoncpp libbz2 libexecinfo libjpeg-turbo libpng libunwind musl musl-utils ncurses openjpeg \ | |||
openblas py3-numpy py3-pillow py3-six postgresql proj-datumgrid proj-util sqlite sqlite-libs \ | |||
subversion tiff zstd zstd-libs | |||
# get source code | |||
cd ~ | |||
wget -c https://grass.osgeo.org/grass88/source/snapshot/grass-8.4.git_src_snapshot_latest.tar.gz | |||
# unpack | |||
tar xvfz grass-8.4.git_src_snapshot_latest.tar.gz | |||
rm -f grass-8.4.git_src_snapshot_latest.tar.gz | |||
# change into source code (update path name as needed) | |||
cd grass-8.4.git_src_snapshot_2021_05_01/ | |||
# minimal configuration | |||
./configure \ | |||
--with-cxx \ | |||
--with-gdal=/usr/bin/gdal-config \ | |||
--with-proj --with-proj-share=/usr/share/proj \ | |||
--with-geos \ | |||
--with-sqlite \ | |||
--without-nls \ | |||
--without-wxwidgets \ | |||
--without-fftw \ | |||
--without-cairo \ | |||
--without-freetype \ | |||
--without-opengl \ | |||
--without-odbc | |||
# compilation | |||
nice make -j2 | |||
</source> | |||
===== Archlinux ===== | |||
You can install GRASS for Archlinux distribution based like Archlinux, Manjaro, EndeavourOS ... | |||
* <big>'''Easiest method : use a prebuilt package using arch4edu repository'''</big> | |||
''"Arch4edu is a community repository for Arch Linux and Arch Linux ARM that strives to provide the latest versions of most software used by college students."'' | |||
1. Add Arch4edu repository. Follow instructions from official documentation: | |||
https://github.com/arch4edu/arch4edu/wiki/Add-arch4edu-to-your-Archlinux | |||
2. Refresh packages list with | |||
pacman -Syyu | |||
3. Install GRASS package | |||
pacman -S grass | |||
* <big>'''Advanced method : use AUR (Arch User Repository) package'''</big> | |||
Up-to-date links to Archlinux GRASS PKGBUILDs are on Arch User Repository. | |||
PKGBUILD downloads and builds automatically sources from https://grass.osgeo.org/download/software/linux/. | |||
You can use an AUR helper like ''pamac'', ''yay'', among others ... More info through this link https://wiki.archlinux.org/title/AUR_helpers | |||
Exemple with ''yay'': | |||
yay -S grass | |||
* <big>'''Expert method : compile from source code'''</big> | |||
If you want to compile it yourself, you could follow steps below : | |||
''(As an alternative it is recommended to download PKGBUILD from AUR and then customize to your needs)'' | |||
Install dependencies : | |||
pacman -S bzip2 cairo fftw fontconfig freetype2 gcc-libs gdal geos glibc glu libpng libtiff libx11 libgl netcdf pdal proj python-gdal python-numpy python-pillow python-wxpython readline zlib zstd | |||
Download and extract sources : https://grass.osgeo.org/download/software/sources/ | |||
We can now start building GRASS | |||
export PATH=~/usr/bin:$PATH && \ | |||
./configure \ | |||
--with-freetype-includes=/usr/include/freetype2 \ | |||
--with-wxwidgets \ | |||
--with-readline \ | |||
--with-pthread \ | |||
--with-netcdf \ | |||
--with-nls \ | |||
--with-geos \ | |||
--with-postgres \ | |||
--with-pdal=/usr/include/pdal \ | |||
--with-bzlib \ | |||
--with-zstd | |||
Now let's compile and install it | |||
make | |||
make install | |||
It's done, you can enjoy GRASS in Arch, just type "grass" in the terminal to launch it or look for grass in your menu. | |||
===== Generic procedure for Debian-based distributions (Ubuntu, ...) ===== | |||
WORK IN PROGRESS | |||
1. Install official GRASS package | |||
sudo apt install grass grass-dev | |||
2. Enable source code download | |||
# do backup first | |||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig | |||
sudo sed -i '/^#\sdeb-src /s/^# *//' /etc/apt/sources.list | |||
3. Install GRASS dependencies | |||
sudo apt build-dep grass | |||
4. Download GRASS source code | |||
git clone https://github.com/osgeo/grass | |||
5. Compile GRASS from source code | |||
cd grass | |||
Configure: | |||
grass --config build | sh | |||
Optionally install missing dependencies (can happen when official GRASS package is not compatible with GRASS main), eg. | |||
sudo apt install libzstd-dev | |||
Compile: | |||
make -j2 | |||
6. Run locally or install | |||
./bin.x86_64-pc-linux-gnu/grass --version | |||
or | |||
sudo make install | |||
grass --version | |||
===== Debian ===== | ===== Debian ===== | ||
* Official [https://wiki.debian.org/DebianGis DebianGIS] packaging control files, available on git server: | |||
https://salsa.debian.org/debian-gis-team/grass | |||
====== GRASS 8 on Debian 11 (bullseye) ====== | |||
Install needed packages for GRASS 8.4: | |||
apt-get update && \ | |||
apt-get install bison debhelper-compat dh-python doxygen fakeroot flex graphviz \ | |||
libblas-dev libbz2-dev libcairo2-dev libfftw3-dev libfreetype6-dev \ | |||
libgdal-dev libgeos-dev libgl1-mesa-dev libglu1-mesa-dev libjpeg-dev liblapack-dev libmotif-dev \ | |||
default-libmysqlclient-dev libncurses5-dev libnetcdf-dev libpng-dev libpq-dev \ | |||
libproj-dev libreadline-dev libsqlite3-dev libtiff-dev libxmu-dev libzstd-dev \ | |||
netcdf-bin pkg-config proj-bin python3 python3-dev python3-numpy python3-pil python3-ply \ | |||
python3-six python3-wxgtk4.0 wget unixodbc-dev zlib1g-dev | |||
Download and unpack GRASS 8.4 source code (or fetch from GitHub: https://github.com/OSGeo/grass): | |||
wget https://grass.osgeo.org/grass84/source/grass-8.4-latest.tar.gz | |||
tar xvfz grass-8.4-latest.tar.gz | |||
cd grass-8.4.* | |||
Configuration: | |||
CFLAGS="-Wall -Werror-implicit-function-declaration -fno-common -Wextra -Wunused" \ | |||
CXXFLAGS="-Wall" \ | |||
./configure \ | |||
--prefix=/usr/local \ | |||
--with-gdal --with-proj --with-proj-share=/usr/share \ | |||
--with-glw --with-nls --with-readline \ | |||
--with-cxx --enable-largefile \ | |||
--with-freetype --with-freetype-includes=/usr/include/freetype2 \ | |||
--with-sqlite --with-cairo --with-python=/usr/bin/python-config \ | |||
--with-wxwidgets --with-geos \ | |||
--with-netcdf=/usr/bin/nc-config --with-odbc=yes \ | |||
--with-openmp=yes --with-pthread=no | |||
Compile: | |||
make -j2 | |||
Install: | |||
make install | |||
Run: | |||
grass --version | |||
===== Ubuntu ===== | ===== Ubuntu ===== | ||
There is a dedicated page on how to [[Compile_and_Install_Ubuntu | Compile the GRASS source code & install it in Ubuntu]]. | |||
===== Linux Mint ===== | |||
The [[Compile_and_Install_Ubuntu | detailed compilation guide for Ubuntu]] may just work. However, here is a short guide for Mint: | |||
<source lang="bash"> | |||
# Linux Mint 21+ | |||
# be sure to have an updated system | |||
sudo apt-get update && sudo apt-get upgrade -y | |||
# installation of required libraries and compile tools | |||
# recommended to give Python3 precedence over Python2 (which is end-of-life since 2024) | |||
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1 | |||
# install compiler tools and further dependencies (tested with Linux Mint 21) | |||
# this is a single command, please copy-paste it entirely into the terminal: | |||
sudo apt-get install \ | |||
build-essential \ | |||
flex make bison gcc libgcc1 g++ cmake ccache \ | |||
libproj-dev proj-data proj-bin \ | |||
libgeos-dev \ | |||
libgdal-dev python3-gdal gdal-bin \ | |||
python3 python3-dev \ | |||
python3-opengl \ | |||
python3-wxgtk4.0 \ | |||
python3-dateutil libgsl-dev python3-numpy \ | |||
wx3.0-headers wx-common libwxgtk3.0-gtk3-dev libwxbase3.0-dev \ | |||
libncurses5-dev zlib1g-dev gettext \ | |||
libbz2-dev libzstd-dev libfreetype6-dev \ | |||
libtiff5-dev libpnglite-dev libcairo2 libcairo2-dev \ | |||
sqlite3 libsqlite3-dev libpq-dev \ | |||
libfftw3-3 libfftw3-dev \ | |||
libboost-thread-dev libboost-program-options-dev \ | |||
subversion \ | |||
checkinstall \ | |||
libglu1-mesa-dev libxmu-dev \ | |||
ghostscript wget -y | |||
</source> | |||
'''GUI''' - update wxpython: | |||
<source lang="bash"> | |||
pip3 install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython | |||
</source> | |||
* | Next steps: | ||
* create a subdirectory in your HOME tree for storing the GRASS source code (and later compilation) | |||
* get source code, one of the two options: | |||
** a) download [https://grass.osgeo.org/grass84/source/snapshot/ GRASS source code weekly snapshot] (e.g. take the "8.x.git snapshot"), or | |||
*** unpack source code | |||
** b) current source code from GitHub: | |||
*** <code>git clone https://github.com/OSGeo/grass.git</code> | |||
* change into the source code directory | |||
<source lang="bash"> | |||
# in the source code directory, "configure" the source code to prepare for compilation: | |||
./configure \ | |||
--with-cxx \ | |||
--with-proj-share=/usr/share/proj \ | |||
--with-gdal=/usr/bin/gdal-config \ | |||
--with-geos \ | |||
--with-sqlite \ | |||
--with-nls \ | |||
--with-zstd \ | |||
--with-cairo --with-cairo-ldflags=-lfontconfig \ | |||
--with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" \ | |||
--with-fftw \ | |||
--with-opengl-libs=/usr/include/GL \ | |||
--without-postgres \ | |||
--without-pdal \ | |||
--without-netcdf \ | |||
--without-mysql \ | |||
--without-odbc \ | |||
--without-openmp | |||
# compile GRASS | |||
make -j2 | |||
# install compiled GRASS on system | |||
sudo make install | |||
# use GRASS! Start on command line | |||
grass | |||
</source> | |||
===== Enterprise Linux ===== | |||
Enterprise Linux (EL) and derivatives (that is, Red Hat Enterprise Linux, CentOS and Scientific Linux) is a popular and robust platform for servers and computing-heavy workstations, and is therefore a good fit for GIS specific requirements. | |||
See: https://wiki.osgeo.org/wiki/Enterprise_Linux_GIS | |||
===== Scientific Linux ===== | |||
See Centos | |||
====== | ===== CentOS ===== | ||
You first need to add the EPEL repository for PROJ and GDAL, see [https://fedoraproject.org/wiki/EPEL/FAQ#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F here] | |||
Preparation '''Centos 8''': | |||
dnf install epel-release | |||
dnf install flex bison make zlib-devel gcc-c++ gettext \ | |||
fftw-devel libtiff-devel sqlite-devel \ | |||
proj proj-devel proj-datumgrid libxml2 \ | |||
geos geos-devel git \ | |||
netcdf netcdf-devel atlas-devel \ | |||
blas-devel lapack-devel libpq-devel \ | |||
python3-devel python3-numpy \ | |||
python3-dateutil python3-imaging python3-matplotlib \ | |||
gdal gdal-libs gdal-python-tools python3-gdal gdal-devel \ | |||
wxGTK3-devel mesa-libGL-devel mesa-libGLU-devel \ | |||
libXmu-devel libX11-devel | |||
'''GRASS 8 compilation and installation''' | |||
[https://grass.osgeo.org/grass84/source/snapshot/ Download source code] (e.g., --> "Download latest 8.4 code)" and configure GRASS 8 (suggestion: save this as script): | |||
make | |||
./configure \ | |||
--with-cxx \ | |||
--with-proj --with-proj-share=/usr/share/proj \ | |||
--with-gdal=/usr/bin/gdal-config \ | |||
--with-sqlite \ | |||
--with-python \ | |||
--with-cairo --with-cairo-ldflags=-lfontconfig \ | |||
--with-freetype --with-freetype-includes=/usr/include/freetype2 \ | |||
--with-wxwidgets=/usr/bin/wx-config \ | |||
--with-openmp \ | |||
--with-blas --with-blas-includes=/usr/include/atlas-x86_64-base/ \ | |||
--with-lapack --with-lapack-includes=/usr/include/atlas-x86_64-base/ \ | |||
--with-fftw \ | |||
--with-geos \ | |||
--with-netcdf \ | |||
--without-ffmpeg \ | |||
--without-mysql \ | |||
--without-postgres \ | |||
--without-odbc \ | |||
--without-fftw | |||
Compile: | |||
make | |||
or on a multicore system (number depends of available cores): | |||
make -j4 | |||
For a system wide installation, run as root user: | |||
make install | |||
OR simply run it directly from the source code directory (substitute ARCH with i686 or x86_64): | |||
bin.$ARCH/grass -gui | |||
In this case, for convenience, add it to the search path: | |||
mkdir $HOME/bin | |||
cd $HOME/bin | |||
# example: | |||
ln -s $HOME/software/grass84_release/bin.x86_64-pc-linux-gnu/grass . | |||
Now use it subsequently with | |||
grass -gui | |||
'''Installation grass on a HPC system with '''Centos 7''' and no root privileges:''' | |||
This assumes that python3, fftw, proj, gdal and geos are available on the HPC system, either as modules or as installed software. | |||
Download and prepare some dependencies (freetypes and zstd) | |||
mkdir -p $HOME/grass/freetypes | |||
cd $HOME/grass/freetypes | |||
wget path/to/freetype-2.9.1.tar.gz | |||
tar -xf freetype-2.9.1.tar.gz | |||
mkdir $HOME/grass/zstd | |||
cd mkdir $HOME/grass/zstd | |||
wget path/to/v1.4.4/zstd-1.4.4.tar.gz | |||
tar -xf zstd-1.4.4.tar.gz | |||
make install PREFIX=./ | |||
Add the ZSTD path to your LD_LIBRARY_PATH | |||
tee -a $HOME/.bashrc > /dev/null << EOT | |||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/grass/zstd/zstd-1.4.4/lib | |||
EOT | |||
The configure command could look like this | |||
./configure \ | |||
-prefix=$HOME/grass \ | |||
--enable-64bit --with-fftw-includes=/path/to/fftw/include/ \ | |||
--with-fftw-libs=/path/to/fftw/lib/ \ | |||
--with-freetype-includes=$HOME/grass/freetypes/freetype-2.9.1/include/ \ | |||
--with-netcdf --with-geos --with-blas --with-lapack --with-postgres \ | |||
--with-zstd-includes=$HOME/grass/zstd/zstd-1.4.4/lib/ \ | |||
--with-zstd-libs=$HOME/grass/zstd/zstd-1.4.4/lib/ \ | |||
--with-gdal=/path/to/gdal-config # This could be the path to a gdal version compiled from source | |||
Finally as usual: | |||
make; make install | |||
grass | |||
====== | ===== Gentoo ===== | ||
./configure \ | |||
--with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" | |||
See also https://packages.gentoo.org/package/sci-geosciences/grass | |||
===== Funtoo ===== | |||
{{MovedToTrac|FuntooLinux}} | |||
===== Fedora ===== | |||
====== GRASS 8 on Fedora ====== | |||
'''Preparation''' for the compilation of GRASS 8+ source code (F36+): | |||
dnf install gcc gcc-c++ bison flex ncurses-devel gettext proj-devel \ | |||
gdal gdal-devel sqlite-devel xml2 mesa-libGL-devel cairo-devel \ | |||
fftw-devel mesa-libGLU-devel libXmu-devel libX11-devel geos geos-devel \ | |||
libtiff-devel python3-devel numpy wxGTK-devel gawk git \ | |||
python3-dateutil python3-imaging python3-matplotlib-wx doxygen python3-sphinx \ | |||
libzstd-devel libzstd python3-six python3-numpy python3-wxpython4 \ | |||
proj-data PDAL-devel PDAL-libs | |||
# optionally also: netcdf-devel postgresql-devel | |||
# atlas-devel lapack-devel lapack-devel | |||
# laszip laszip-devel | |||
# proj-data-at proj-data-au proj-data-be ... | |||
'' | ''Note 1: the optional ffmpeg-devel comes from the rpmfusion-free repository ([https://rpmfusion.org/Configuration/ configuration]).'' | ||
'''Download''' and unpack the source code: | |||
* GRASS 8: [https://grass.osgeo.org/grass84/source/snapshot/ weekly snapshot] - [https://github.com/OSGeo/grass/releases GitHub repository] | |||
'''Configure''': This is an example how to configure the source code on a Fedora system: | |||
./configure \ | ./configure \ | ||
--with-cxx \ | |||
--with-gdal=/usr/bin/gdal-config \ | |||
--with-proj --with-proj-share=/usr/share/proj \ | |||
--with-geos \ | |||
--with-pdal \ | |||
--with-sqlite \ | |||
--with-nls \ | |||
--with-wxwidgets=/usr/bin/wx-config \ | |||
--with-fftw \ | |||
--with-cairo --with-cairo-ldflags=-lfontconfig \ | |||
--with-freetype --with-freetype-includes=/usr/include/freetype2 \ | |||
--enable-largefile \ | |||
--without-odbc | |||
''Extra 1:'' If you also want '''FFMPEG support''' - it requires 'dnf install fftw-devel' from the rpmfusion-free repository. Then add to the configuration lines above: | |||
--with-ffmpeg --with-ffmpeg-includes="/usr/include/ffmpeg /usr/include/ffmpeg/libav* /usr/include/ffmpeg/libpostproc /usr/include/ffmpeg/libswscale" \ | |||
''Extra 2:'' For '''LAPACK/BLAS support''' (addons i.spec.unmix, v.kriging etc), install "dnf install lapack lapack-devel blas blas-devel atlas atlas-devel". Then add to the configuration lines above: | |||
--with-blas --with-blas-includes=/usr/include/atlas-x86_64-base/ \ | |||
--with-lapack --with-lapack-includes=/usr/include/atlas-x86_64-base/ \ | |||
''Extra 3:'' For '''ZSTD support''' (Zstandard compression algorithm), first install "dnf install libzstd libzstd-devel zstd". After installing the zstd related packages, add to the configuration lines above: | |||
--with-zstd \ | |||
Finally '''compile''' the configured source code: | |||
make | make | ||
or on multicore (number depends of available cores): | |||
make -j4 | |||
and | |||
make install # requires root permissions unless you become owner of /usr/local/ | |||
Then use GRASS 8 and enjoy! | |||
grass --version | |||
===== openSUSE ===== | |||
To build GRASS on openSUSE: | |||
''Application:Geo'' repo to be added (see [https://software.opensuse.org//download.html?project=Application%3AGeo&package=gdal Install package Application:Geo] | |||
<source lang="bash"> | |||
# example for Leap 42 version: | |||
sudo zypper addrepo https://download.opensuse.org/repositories/Application:Geo/openSUSE_Leap_42.3/Application:Geo.repo | |||
sudo zypper refresh | |||
</source> | |||
RPM packages to be installed: | |||
<source lang="bash"> | |||
sudo zypper install bison flex freetype2-devel fftw3-devel gcc-c++ \ | |||
libgdal-devel libgeos-devel libjpeg-devel libpng-devel libtiff-devel \ | |||
man proj libproj-devel readline-devel netcdf-devel ncurses-devel \ | |||
mysql-devel postgresql-devel sqlite-devel unixODBC-devel \ | |||
tcl-devel tk-devel xorg-x11-Mesa-devel libXmu-devel \ | |||
python-numpy python-dateutil python-devel python-opengl \ | |||
python-wxWidgets python-xml python-dateutil wxWidgets-devel \ | |||
zlib-devel doxygen python-sphinx | |||
</source> | |||
Source code configuration: | |||
<source lang="bash"> | |||
./configure \ | |||
--enable-largefile \ | |||
--with-proj-share=/usr/share/proj \ | |||
--with-cxx \ | |||
--with-lapack=yes \ | |||
--with-motif \ | |||
--with-gdal=/usr/bin/gdal-config \ | |||
--with-postgres --with-postgres-includes=/usr/include/pgsql \ | |||
--with-mysql --with-mysql-includes=/usr/include/mysql \ | |||
--with-fftw \ | |||
--with-readline \ | |||
--with-netcdf \ | |||
--with-geos \ | |||
--with-nls \ | |||
--with-sqlite \ | |||
--with-freetype \ | |||
--with-freetype-includes=/usr/include/freetype2 \ | |||
--with-wxwidgets \ | |||
--with-odbc \ | |||
--with-python | |||
</source> | |||
Then compile with "make [-j2]". | |||
===== RPM SPEC files ===== | ===== RPM SPEC files ===== | ||
* [https://build.opensuse.org/package/show?package=grass&project=Application%3AGeo OpenSuSe] | |||
* [https://pkgs.fedoraproject.org/cgit/rpms/grass.git/tree/grass.spec Fedora] | |||
* ... | |||
==== macOS ==== | |||
Compiling GRASS for macOS is not fundamentally different from for other *nix systems. It is on the contrary quite similar, but what differ is the lack of a default package management system for software GRASS depends on. This leaves the mac user to either: (1) compile the dependencies one-by-one; (2) compiling with one of the third-party package management systems avaliable; or (4) a combination thereof. | |||
If you are interested in installing a precompiled version, please check out the [https://grass.osgeo.org/download/software/mac-osx/ official download site]. | |||
To date, maybe the easiest way to compile for Mac is by using [https://github.com/nilason/grass-conda GRASS app build script] which is based on the instructions below for building using Anaconda. It will install dependencies, package and install an app bundle with just a command in Terminal. | |||
==== | ===== Compilation and installation ===== | ||
For more up-to-date instructions please read: | |||
* [https://github.com/nilason/grass-conda Compiling on macOS using Conda] (Intel / Apple silicon based machine M1) | |||
* [[Compiling on macOS using Anaconda]] | |||
* [[Compiling on macOS using Homebrew]] | |||
* [[Compiling on macOS using MacPorts]] | |||
===== Legacy instructions ===== | |||
The following compilation and installation instructions are rather outdated as a whole. They do, however, contain parts and snippets that still may be very instructive and useful. | |||
* | * [[Compiling on MacOSX]] | ||
* [[Compiling on MacOSX using Fink]] | |||
* [https://web.archive.org/web/20180718005252/https://www.kyngchaos.com/software/frameworks#build_scripts build scripts for dependencies] | |||
* | Troubleshooting: | ||
* solving errors at starting GRASS: [[MacOSX GRASS errors]] | |||
==== FreeBSD / NetBSD ==== | |||
The | The recommended compiler tools are GCC, GNU make, GNU coreutils (for install), and flex. All are available through the respective package managing tools (pkg_add for FreeBSD and pkgin install for NetBSD) and for recent *BSD versions most likely installed by default. | ||
GRASS 8 should compile on FreeBSD and NetBSD. | |||
It is highly recommended to install GDAL/OGR and PROJ first. These libraries and tools are available as [https://www.freebsd.org/ports/ ports for FreeBSD] and [https://www.pkgsrc.org/ packages for NetBSD]. | |||
Optional functionality is listed with ''./configure --help'', and related libraries and tools might need to be installed first. | |||
You then may need to edit include/Make/Platform.make and set | |||
ICONVLIB = -liconv | |||
==== AIX ==== | |||
A recent [ftp://ftp.gnu.org/gnu/make/ GNU make] (>= 3.81) and GNU coreutils are required. These are available with the [https://www-03.ibm.com/systems/power/software/aix/linux/toolbox/download.html IBM AIX toolbox] or through third-party AIX software repositories, e.g. [https://www.bullfreeware.com/ bullfreeware] and [https://www.perzl.org/aix/ perzl.org]. Note that 'make' does not work, only 'gmake' works. | |||
General instructions to compile on AIX are e.g. [https://www.perzl.org/aix/index.php?n=Main.Instructions here] | |||
On AIX, compilation results by default in 32 bit applications and static libraries. The [https://developer.ibm.com/components/aix/ IBM documentation] explains how to build 64 bit applications and shared libraries with GCC. | |||
'''GRASS 8: Using the IBM xlc compiler:''' | |||
Get and install (in this order): | |||
* [ftp://ftp.gnu.org/gnu/tar/ GNU tar] | |||
* [ftp://ftp.gnu.org/gnu/make/ GNU make] (>= 3.81) | |||
* [https://www.sqlite.org SQLite] | |||
* [https://trac.osgeo.org/proj/ PROJ.4] (for ./configure parameters, see [[Talk:Compile and Install|here]]) | |||
* [https://www.gdal.org GDAL] (for ./configure parameters, see [[Talk:Compile and Install|here]]) | |||
* [https://grass.osgeo.org/grass84/source/snapshot/ GRASS 8] | |||
The environment variables and configure command that worked: | |||
<pre> | |||
## AIX 5.x | |||
export LIBPATH=/opt/freeware/lib64:/opt/freeware/lib | |||
# make 'ar' happy | |||
export OBJECT_MODE=64 | |||
PREFIX=$HOME/private/bin | |||
./configure \ | |||
--prefix=$PREFIX \ | |||
--disable-shared \ | |||
--with-cxx \ | |||
--with-proj-includes=$PREFIX/include/ \ | |||
--with-proj-libs=$PREFIX/lib/ \ | |||
--with-proj-share=$PREFIX/share/proj/ \ | |||
--with-sqlite \ | |||
--with-sqlite-includes=$PREFIX/include/ \ | |||
--with-sqlite-libs=$PREFIX/lib/ \ | |||
--with-tiff=no \ | |||
--with-png=no \ | |||
--with-fftw=no \ | |||
--with-cairo=no \ | |||
--with-freetype=no | |||
</pre> | |||
'''GRASS 8: Using the GNU gcc compiler:''' | |||
Get and install (in this order): | |||
* if needed, [ftp://ftp.gnu.org/gnu/tar/ GNU tar] | |||
* if needed (the name is often 'gmake' and not 'make') [ftp://ftp.gnu.org/gnu/make/ GNU make] (>= 3.81) | |||
* [https://www.sqlite.org SQLite] | |||
* [https://trac.osgeo.org/proj/ PROJ.4] (for ./configure parameters, see [[Talk:Compile and Install|here]]) | |||
* [https://www.gdal.org GDAL] (for ./configure parameters, see [[Talk:Compile and Install|here]]) | |||
* [https://grass.osgeo.org/grass84/source/snapshot/ GRASS 8] | |||
The environment variables and configure command that worked for AIX 7.x: | |||
<pre> | |||
## AIX 7.x | |||
export CC="gcc" | |||
export CXX="g++" | |||
PREFIX=$HOME/bin | |||
LDFLAGS="-Wl,-bsvr4,-R,/opt/freeware/lib -L/opt/freeware/lib" CPPFLAGS="-I/opt/freeware/include" ./configure \ | |||
--prefix=$PREFIX \ | |||
--enable-shared \ | |||
--with-includes=/opt/freeware/include --with-libs=/opt/freeware/lib \ | |||
--with-cxx \ | |||
--with-proj-includes=$PREFIX/include/ \ | |||
--with-proj-libs=$PREFIX/lib/ \ | |||
--with-proj-share=$PREFIX/share/proj/ \ | |||
--with-gdal=$PREFIX/bin/gdal-config \ | |||
--with-sqlite \ | |||
--with-sqlite-libs=$PREFIX/lib --with-sqlite-includes=$PREFIX/include \ | |||
--with-png=no \ | |||
--with-tiff=no \ | |||
--with-fftw=no \ | |||
--with-cairo=no \ | |||
--with-opengl=no \ | |||
--with-freetype=no | |||
</pre> | |||
==== MS-Windows ==== | ==== MS-Windows ==== | ||
===== MS-Windows/ | See also [[WinGRASS Current Status]] for latest updates. | ||
===== MS-Windows/native ===== | |||
GRASS on Windows using a standalone installer. It is still MinGW based (we are going to move this to CMake in 2024+). | |||
Instructions to compile from source code: | |||
* [https://trac.osgeo.org/grass/wiki/CompileOnWindows GRASS Windows Native Binary Building Guide] | |||
===== MS-Windows/OSGeo4W ===== | |||
OSGeo4W is an installer for a broad set of open source geospatial software packages including GRASS as well as many other packages (QGIS, GDAL/OGR, and more). | |||
* See [https://trac.osgeo.org/osgeo4w/ OSGeo4W] | |||
===== MS-Windows/Cygwin ===== | |||
See | * See the [[Cygwin]] wiki pages | ||
=== Common problems and solutions === | === Common problems and solutions === | ||
Line 410: | Line 829: | ||
** this suggests that you don't have the X headers installed | ** this suggests that you don't have the X headers installed | ||
** Solution: Install the libx11-dev package | ** Solution: Install the libx11-dev package | ||
* error: g.list: error while loading shared libraries: libgdal1.6.0.so.1: cannot open shared object file: No such file or directory | |||
** this error appears in the shell right after the user clicks GUI's "Start GRASS" button. The GUI shows an error about geographic extent and gets closed afterwards. | |||
** It happens when you launch bin.i686 executable on 64bit system. Be careful and choose the right architecture. | |||
* error: lib/python/ctypes | |||
** This error appears during the compilation: <code>free(): invalid pointer Aborted (core dumped)</code> | |||
** It happens when you have multiple <code>libproj</code> versions on your system (check it with command <code>ldd PATH_TO_GRASS_INSTALL/lib/libgrass_gproj.so | grep proj</code> - when this is not your problem, you should obtain exactly one result) | |||
** Solution: Try to reinstall <code>libproj-dev</code> and <code>proj-data</code> | |||
=== Static compilation === | |||
In order to get static rather than dynamically linked binaries, configure like this: | |||
./configure --disable-shared --enable-static | |||
This will however break the wxGUI and GRASS 8 completely because "ctypes" wants to link against shared libs, or there is something in the static libs that "ctypes" does not like. | |||
=== Optimization === | === Optimization === | ||
GCC and other compilers support [ | GCC and other compilers support [https://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Optimize-Options.html#Optimize-Options optimization] | ||
If you would like to set compiler optimisations, for a possibly faster binary, type (don't enter a ";" anywhere): | If you would like to set compiler optimisations, for a possibly faster binary, type (don't enter a ";" anywhere): | ||
Line 435: | Line 871: | ||
gcc -dumpspecs | gcc -dumpspecs | ||
See also: | See also: https://gcc.gnu.org/ | ||
A real fast GRASS version (and small binaries) will be created with LDFLAGS set to "stripping" (but this disables debugging): | A real fast GRASS version (and small binaries) will be created with LDFLAGS set to "stripping" (but this disables debugging): | ||
Line 459: | Line 895: | ||
r3.showdspf uses the Motif widget (so you also need a | r3.showdspf uses the Motif widget (so you also need a | ||
Motif library, e.g. Lesstif or OpenMotif). | Motif library, e.g. Lesstif or OpenMotif). | ||
[ | [https://grass.itc.it/pipermail/grassuser/2006-December/037475.html Glynn Clements at GRASS-user mailing list] | ||
=== Parallelized compilation on multi-core CPUs === | === Parallelized compilation on multi-core CPUs === | ||
Line 467: | Line 903: | ||
<!-- CFLAGS="-pipe" doesn't seem to help much --> | <!-- CFLAGS="-pipe" doesn't seem to help much --> | ||
== GRASS-GDAL plugin == | |||
* see [[Compile and install GRASS and QGIS with GDAL/OGR Plugin]] | |||
== Addons == | == Addons == | ||
Please note that the installation of [https://grass.osgeo.org/grass-stable/manuals/addons/ GRASS addons] can be easily done with the {{cmd|g.extension}} manager. The compile instructions below are aiming at own development. | |||
=== Compiled modules === | |||
This is the general way which works for C modules as well as scripts (Python or Shell/Bash modules) which has HTML documentation. | |||
'''Requirements:''' | '''Requirements:''' | ||
Line 485: | Line 925: | ||
Each of the [[GRASS_AddOns|addon]] modules should come with a Makefile. To compile it, just run: | Each of the [[GRASS_AddOns|addon]] modules should come with a Makefile. To compile it, just run: | ||
make MODULE_TOPDIR=/path/to/ | make MODULE_TOPDIR=/path/to/grass84/ | ||
Note that the <tt>/path/to/grass84</tt> has to be absolute, not relative. | |||
If using Bash it may be useful to set that up as an alias: | |||
alias gmake64='make MODULE_TOPDIR=/path/to/grass84/' | |||
Installation (requires | Installation (perhaps requires "sudo"): | ||
make MODULE_TOPDIR=/path/to/ | make MODULE_TOPDIR=/path/to/grass84/ install | ||
Note: Compiled addons may require a re-compilation if you changed/updated your GRASS standard binaries. | Note: Compiled addons may require a re-compilation if you changed/updated your GRASS standard binaries. | ||
Line 494: | Line 939: | ||
==== If binary comes with a -dev package ==== | ==== If binary comes with a -dev package ==== | ||
''(work in progress, this text states how it eventually will be :)'' | |||
Nowadays one does not need to the source code, nor compiling GRASS by oneself to be able to add add-ons. On Debian, you can just install the grass-dev package and then run: | Nowadays one does not need to the source code, nor compiling GRASS by oneself to be able to add add-ons. On Debian, you can just install the grass-dev package and then run: | ||
make MODULE_TOPDIR=/usr/lib/ | make MODULE_TOPDIR=/usr/lib/grass84/ INST_DIR=/usr/lib/grass84/ | ||
The grass-dev package essentially provides GRASS's <tt>include</tt> header files and Make configuration files. | The grass-dev package essentially provides GRASS's <tt>include</tt> header files and Make configuration files. | ||
Line 509: | Line 955: | ||
Make sure that the script is executable, then just call it in GRASS typing the filename. Python scripts need to be called writing the extension as well, like: | Make sure that the script is executable, then just call it in GRASS typing the filename. Python scripts need to be called writing the extension as well, like: | ||
GRASS | GRASS (nc_spm):~ > v.krige.py | ||
[[Category:Development]] | [[Category:Development]] | ||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Installation]] | [[Category:Installation]] |
Latest revision as of 08:46, 29 April 2025
Disclaimer: This page explains how to turn the GRASS source code into an installable binary package ("compilation") for different operating systems. If you just want to get ready-to-use binaries, go here, otherwise read on...
How to do compilation and installation of GRASS?
Here we explain the procedure to compile GRASS from GitHub, but it also applies to official GRASS 8 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
Extra libraries
GRASS needs at least two extra libraries: PROJ and GDAL/OGR. It is recommended to download them as ready-to-use packages for your software platform (Linux distribution, Windows, Mac...).
Other libraries needed to run GRASS are listed on the requirements page.
To compile, you will also need the respective "-devel" packages; see below for details.
Download GRASS source code
First, download the GRASS source code.
Generic Compilation and installation procedure
- 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/) just follow this:
cd /usr/local/src/ su -c 'mkdir grass8' su -c 'chown yourlogin:yourgroup grass8'
Otherwise if you have permissions just continue as a normal user:
mkdir $HOME/src cd $HOME/src/ git clone https://github.com/OSGeo/grass.git grass_main
- 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 | less
It may (!) look like this:
./configure \ --with-cxx \ --with-sqlite \ --with-python \ --with-geos \ --with-gdal=/usr/bin/gdal-config \ --with-cairo --with-cairo-ldflags=-lfontconfig \ --with-freetype \ --with-freetype-includes=/usr/include/freetype2 \ --with-proj --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. See Platform Specific Notes below.
Depending on your needs it may be a good idea to include debugging hooks.
CFLAGS="-ggdb -Wall -Werror-implicit-function-declaration" ./configure ...
At the end of configuration process you should get report not much different from this:
GRASS is now configured for: x86_64-pc-linux-gnu Source directory: /home/user/software/grass_main Build directory: /home/user/software/grass_main Installation directory: ${prefix}/grass84 Startup script in directory:${exec_prefix}/bin C compiler: gcc -O2 -march=native -std=gnu99 -fexceptions -fstack-protector -m64 -fdiagnostics-color C++ compiler: c++ -g -Wall Building shared libraries: yes OpenGL platform: X11 MacOSX application: no MacOSX architectures: MacOSX SDK: BLAS support: yes BZIP2 support: no C++ support: yes Cairo support: yes DWG support: no FFTW support: yes FreeType support: yes GDAL support: yes GEOS support: yes [...]
- Let's compile it (takes a little while...)!
make -j2
- At the end, you should get report not much different from this:
---------------------------------------------------------------------- Following modules are missing the 'description.html' file in src code: ---------------------------------------------------------------------- GRASS compilation log ------------------------- Started compilation: Mon 19 Aug 2024 10:47:57 PM CEST -- Errors in: No errors detected. -- Finished compilation: Mon 19 Aug 2024 10:55:12 PM CEST (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 occurring 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:
grass
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 R_statistics/ R.
- Compile and install GRASS and QGIS with GDAL/OGR Plugin (enables QGIS to read GRASS data directly)
Compile and install GDAL-GRASS plugin
Platform Specific Notes
Linux
Linux comes in various flavours, i.e. distributions.
Examples:
- Archlinux: https://aur.archlinux.org/packages/grass
- Centos: https://src.fedoraproject.org/rpms/grass
- Debian: https://trac.osgeo.org/grass/wiki/DebianUbuntuPackaging
- EPEL: https://src.fedoraproject.org/rpms/grass
- Fedora: https://src.fedoraproject.org/rpms/grass
- Ubuntu: https://trac.osgeo.org/grass/wiki/DebianUbuntuPackaging
Alpine Linux
# install compiler tools and libraries
apk add build-base bzip2-dev cairo-dev fftw-dev freetype-dev g++ gcc gdal-dev geos-dev git \
gnutls-dev libc6-compat libjpeg-turbo-dev libpng-dev make openjpeg-dev openblas-dev \
postgresql-dev proj-dev python3-dev py3-numpy-dev sqlite-dev tar tiff-dev unzip vim \
wget zip zstd-dev
# install needed tools and libraries when using GRASS
apk add attr bash bison bzip2 cairo curl fftw flex freetype gdal gdal-tools gettext geos gnutls \
jsoncpp libbz2 libexecinfo libjpeg-turbo libpng libunwind musl musl-utils ncurses openjpeg \
openblas py3-numpy py3-pillow py3-six postgresql proj-datumgrid proj-util sqlite sqlite-libs \
subversion tiff zstd zstd-libs
# get source code
cd ~
wget -c https://grass.osgeo.org/grass88/source/snapshot/grass-8.4.git_src_snapshot_latest.tar.gz
# unpack
tar xvfz grass-8.4.git_src_snapshot_latest.tar.gz
rm -f grass-8.4.git_src_snapshot_latest.tar.gz
# change into source code (update path name as needed)
cd grass-8.4.git_src_snapshot_2021_05_01/
# minimal configuration
./configure \
--with-cxx \
--with-gdal=/usr/bin/gdal-config \
--with-proj --with-proj-share=/usr/share/proj \
--with-geos \
--with-sqlite \
--without-nls \
--without-wxwidgets \
--without-fftw \
--without-cairo \
--without-freetype \
--without-opengl \
--without-odbc
# compilation
nice make -j2
Archlinux
You can install GRASS for Archlinux distribution based like Archlinux, Manjaro, EndeavourOS ...
- Easiest method : use a prebuilt package using arch4edu repository
"Arch4edu is a community repository for Arch Linux and Arch Linux ARM that strives to provide the latest versions of most software used by college students."
1. Add Arch4edu repository. Follow instructions from official documentation:
https://github.com/arch4edu/arch4edu/wiki/Add-arch4edu-to-your-Archlinux
2. Refresh packages list with
pacman -Syyu
3. Install GRASS package
pacman -S grass
- Advanced method : use AUR (Arch User Repository) package
Up-to-date links to Archlinux GRASS PKGBUILDs are on Arch User Repository. PKGBUILD downloads and builds automatically sources from https://grass.osgeo.org/download/software/linux/.
You can use an AUR helper like pamac, yay, among others ... More info through this link https://wiki.archlinux.org/title/AUR_helpers
Exemple with yay:
yay -S grass
- Expert method : compile from source code
If you want to compile it yourself, you could follow steps below :
(As an alternative it is recommended to download PKGBUILD from AUR and then customize to your needs)
Install dependencies :
pacman -S bzip2 cairo fftw fontconfig freetype2 gcc-libs gdal geos glibc glu libpng libtiff libx11 libgl netcdf pdal proj python-gdal python-numpy python-pillow python-wxpython readline zlib zstd
Download and extract sources : https://grass.osgeo.org/download/software/sources/
We can now start building GRASS
export PATH=~/usr/bin:$PATH && \ ./configure \ --with-freetype-includes=/usr/include/freetype2 \ --with-wxwidgets \ --with-readline \ --with-pthread \ --with-netcdf \ --with-nls \ --with-geos \ --with-postgres \ --with-pdal=/usr/include/pdal \ --with-bzlib \ --with-zstd
Now let's compile and install it
make make install
It's done, you can enjoy GRASS in Arch, just type "grass" in the terminal to launch it or look for grass in your menu.
Generic procedure for Debian-based distributions (Ubuntu, ...)
WORK IN PROGRESS
1. Install official GRASS package
sudo apt install grass grass-dev
2. Enable source code download
# do backup first sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig sudo sed -i '/^#\sdeb-src /s/^# *//' /etc/apt/sources.list
3. Install GRASS dependencies
sudo apt build-dep grass
4. Download GRASS source code
git clone https://github.com/osgeo/grass
5. Compile GRASS from source code
cd grass
Configure:
grass --config build | sh
Optionally install missing dependencies (can happen when official GRASS package is not compatible with GRASS main), eg.
sudo apt install libzstd-dev
Compile:
make -j2
6. Run locally or install
./bin.x86_64-pc-linux-gnu/grass --version
or
sudo make install grass --version
Debian
- Official DebianGIS packaging control files, available on git server:
https://salsa.debian.org/debian-gis-team/grass
GRASS 8 on Debian 11 (bullseye)
Install needed packages for GRASS 8.4:
apt-get update && \ apt-get install bison debhelper-compat dh-python doxygen fakeroot flex graphviz \ libblas-dev libbz2-dev libcairo2-dev libfftw3-dev libfreetype6-dev \ libgdal-dev libgeos-dev libgl1-mesa-dev libglu1-mesa-dev libjpeg-dev liblapack-dev libmotif-dev \ default-libmysqlclient-dev libncurses5-dev libnetcdf-dev libpng-dev libpq-dev \ libproj-dev libreadline-dev libsqlite3-dev libtiff-dev libxmu-dev libzstd-dev \ netcdf-bin pkg-config proj-bin python3 python3-dev python3-numpy python3-pil python3-ply \ python3-six python3-wxgtk4.0 wget unixodbc-dev zlib1g-dev
Download and unpack GRASS 8.4 source code (or fetch from GitHub: https://github.com/OSGeo/grass):
wget https://grass.osgeo.org/grass84/source/grass-8.4-latest.tar.gz tar xvfz grass-8.4-latest.tar.gz cd grass-8.4.*
Configuration:
CFLAGS="-Wall -Werror-implicit-function-declaration -fno-common -Wextra -Wunused" \ CXXFLAGS="-Wall" \ ./configure \ --prefix=/usr/local \ --with-gdal --with-proj --with-proj-share=/usr/share \ --with-glw --with-nls --with-readline \ --with-cxx --enable-largefile \ --with-freetype --with-freetype-includes=/usr/include/freetype2 \ --with-sqlite --with-cairo --with-python=/usr/bin/python-config \ --with-wxwidgets --with-geos \ --with-netcdf=/usr/bin/nc-config --with-odbc=yes \ --with-openmp=yes --with-pthread=no
Compile:
make -j2
Install:
make install
Run:
grass --version
Ubuntu
There is a dedicated page on how to Compile the GRASS source code & install it in Ubuntu.
Linux Mint
The detailed compilation guide for Ubuntu may just work. However, here is a short guide for Mint:
# Linux Mint 21+
# be sure to have an updated system
sudo apt-get update && sudo apt-get upgrade -y
# installation of required libraries and compile tools
# recommended to give Python3 precedence over Python2 (which is end-of-life since 2024)
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# install compiler tools and further dependencies (tested with Linux Mint 21)
# this is a single command, please copy-paste it entirely into the terminal:
sudo apt-get install \
build-essential \
flex make bison gcc libgcc1 g++ cmake ccache \
libproj-dev proj-data proj-bin \
libgeos-dev \
libgdal-dev python3-gdal gdal-bin \
python3 python3-dev \
python3-opengl \
python3-wxgtk4.0 \
python3-dateutil libgsl-dev python3-numpy \
wx3.0-headers wx-common libwxgtk3.0-gtk3-dev libwxbase3.0-dev \
libncurses5-dev zlib1g-dev gettext \
libbz2-dev libzstd-dev libfreetype6-dev \
libtiff5-dev libpnglite-dev libcairo2 libcairo2-dev \
sqlite3 libsqlite3-dev libpq-dev \
libfftw3-3 libfftw3-dev \
libboost-thread-dev libboost-program-options-dev \
subversion \
checkinstall \
libglu1-mesa-dev libxmu-dev \
ghostscript wget -y
GUI - update wxpython:
pip3 install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
Next steps:
- create a subdirectory in your HOME tree for storing the GRASS source code (and later compilation)
- get source code, one of the two options:
- a) download GRASS source code weekly snapshot (e.g. take the "8.x.git snapshot"), or
- unpack source code
- b) current source code from GitHub:
git clone https://github.com/OSGeo/grass.git
- a) download GRASS source code weekly snapshot (e.g. take the "8.x.git snapshot"), or
- change into the source code directory
# in the source code directory, "configure" the source code to prepare for compilation:
./configure \
--with-cxx \
--with-proj-share=/usr/share/proj \
--with-gdal=/usr/bin/gdal-config \
--with-geos \
--with-sqlite \
--with-nls \
--with-zstd \
--with-cairo --with-cairo-ldflags=-lfontconfig \
--with-freetype=yes --with-freetype-includes="/usr/include/freetype2/" \
--with-fftw \
--with-opengl-libs=/usr/include/GL \
--without-postgres \
--without-pdal \
--without-netcdf \
--without-mysql \
--without-odbc \
--without-openmp
# compile GRASS
make -j2
# install compiled GRASS on system
sudo make install
# use GRASS! Start on command line
grass
Enterprise Linux
Enterprise Linux (EL) and derivatives (that is, Red Hat Enterprise Linux, CentOS and Scientific Linux) is a popular and robust platform for servers and computing-heavy workstations, and is therefore a good fit for GIS specific requirements.
See: https://wiki.osgeo.org/wiki/Enterprise_Linux_GIS
Scientific Linux
See Centos
CentOS
You first need to add the EPEL repository for PROJ and GDAL, see here
Preparation Centos 8:
dnf install epel-release
dnf install flex bison make zlib-devel gcc-c++ gettext \ fftw-devel libtiff-devel sqlite-devel \ proj proj-devel proj-datumgrid libxml2 \ geos geos-devel git \ netcdf netcdf-devel atlas-devel \ blas-devel lapack-devel libpq-devel \ python3-devel python3-numpy \ python3-dateutil python3-imaging python3-matplotlib \ gdal gdal-libs gdal-python-tools python3-gdal gdal-devel \ wxGTK3-devel mesa-libGL-devel mesa-libGLU-devel \ libXmu-devel libX11-devel
GRASS 8 compilation and installation
Download source code (e.g., --> "Download latest 8.4 code)" and configure GRASS 8 (suggestion: save this as script):
./configure \ --with-cxx \ --with-proj --with-proj-share=/usr/share/proj \ --with-gdal=/usr/bin/gdal-config \ --with-sqlite \ --with-python \ --with-cairo --with-cairo-ldflags=-lfontconfig \ --with-freetype --with-freetype-includes=/usr/include/freetype2 \ --with-wxwidgets=/usr/bin/wx-config \ --with-openmp \ --with-blas --with-blas-includes=/usr/include/atlas-x86_64-base/ \ --with-lapack --with-lapack-includes=/usr/include/atlas-x86_64-base/ \ --with-fftw \ --with-geos \ --with-netcdf \ --without-ffmpeg \ --without-mysql \ --without-postgres \ --without-odbc \ --without-fftw
Compile:
make
or on a multicore system (number depends of available cores):
make -j4
For a system wide installation, run as root user:
make install
OR simply run it directly from the source code directory (substitute ARCH with i686 or x86_64):
bin.$ARCH/grass -gui
In this case, for convenience, add it to the search path:
mkdir $HOME/bin cd $HOME/bin # example: ln -s $HOME/software/grass84_release/bin.x86_64-pc-linux-gnu/grass .
Now use it subsequently with
grass -gui
Installation grass on a HPC system with Centos 7 and no root privileges:
This assumes that python3, fftw, proj, gdal and geos are available on the HPC system, either as modules or as installed software.
Download and prepare some dependencies (freetypes and zstd)
mkdir -p $HOME/grass/freetypes cd $HOME/grass/freetypes wget path/to/freetype-2.9.1.tar.gz tar -xf freetype-2.9.1.tar.gz
mkdir $HOME/grass/zstd cd mkdir $HOME/grass/zstd wget path/to/v1.4.4/zstd-1.4.4.tar.gz tar -xf zstd-1.4.4.tar.gz make install PREFIX=./
Add the ZSTD path to your LD_LIBRARY_PATH
tee -a $HOME/.bashrc > /dev/null << EOT export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/grass/zstd/zstd-1.4.4/lib EOT
The configure command could look like this
./configure \ -prefix=$HOME/grass \ --enable-64bit --with-fftw-includes=/path/to/fftw/include/ \ --with-fftw-libs=/path/to/fftw/lib/ \ --with-freetype-includes=$HOME/grass/freetypes/freetype-2.9.1/include/ \ --with-netcdf --with-geos --with-blas --with-lapack --with-postgres \ --with-zstd-includes=$HOME/grass/zstd/zstd-1.4.4/lib/ \ --with-zstd-libs=$HOME/grass/zstd/zstd-1.4.4/lib/ \ --with-gdal=/path/to/gdal-config # This could be the path to a gdal version compiled from source
Finally as usual:
make; make install grass
Gentoo
./configure \ --with-freetype=yes --with-freetype-includes="/usr/include/freetype2/"
See also https://packages.gentoo.org/package/sci-geosciences/grass
Funtoo
Fedora
GRASS 8 on Fedora
Preparation for the compilation of GRASS 8+ source code (F36+):
dnf install gcc gcc-c++ bison flex ncurses-devel gettext proj-devel \ gdal gdal-devel sqlite-devel xml2 mesa-libGL-devel cairo-devel \ fftw-devel mesa-libGLU-devel libXmu-devel libX11-devel geos geos-devel \ libtiff-devel python3-devel numpy wxGTK-devel gawk git \ python3-dateutil python3-imaging python3-matplotlib-wx doxygen python3-sphinx \ libzstd-devel libzstd python3-six python3-numpy python3-wxpython4 \ proj-data PDAL-devel PDAL-libs
# optionally also: netcdf-devel postgresql-devel # atlas-devel lapack-devel lapack-devel # laszip laszip-devel # proj-data-at proj-data-au proj-data-be ...
Note 1: the optional ffmpeg-devel comes from the rpmfusion-free repository (configuration).
Download and unpack the source code:
- GRASS 8: weekly snapshot - GitHub repository
Configure: This is an example how to configure the source code on a Fedora system:
./configure \ --with-cxx \ --with-gdal=/usr/bin/gdal-config \ --with-proj --with-proj-share=/usr/share/proj \ --with-geos \ --with-pdal \ --with-sqlite \ --with-nls \ --with-wxwidgets=/usr/bin/wx-config \ --with-fftw \ --with-cairo --with-cairo-ldflags=-lfontconfig \ --with-freetype --with-freetype-includes=/usr/include/freetype2 \ --enable-largefile \ --without-odbc
Extra 1: If you also want FFMPEG support - it requires 'dnf install fftw-devel' from the rpmfusion-free repository. Then add to the configuration lines above:
--with-ffmpeg --with-ffmpeg-includes="/usr/include/ffmpeg /usr/include/ffmpeg/libav* /usr/include/ffmpeg/libpostproc /usr/include/ffmpeg/libswscale" \
Extra 2: For LAPACK/BLAS support (addons i.spec.unmix, v.kriging etc), install "dnf install lapack lapack-devel blas blas-devel atlas atlas-devel". Then add to the configuration lines above:
--with-blas --with-blas-includes=/usr/include/atlas-x86_64-base/ \ --with-lapack --with-lapack-includes=/usr/include/atlas-x86_64-base/ \
Extra 3: For ZSTD support (Zstandard compression algorithm), first install "dnf install libzstd libzstd-devel zstd". After installing the zstd related packages, add to the configuration lines above:
--with-zstd \
Finally compile the configured source code:
make or on multicore (number depends of available cores): make -j4 and make install # requires root permissions unless you become owner of /usr/local/
Then use GRASS 8 and enjoy!
grass --version
openSUSE
To build GRASS on openSUSE:
Application:Geo repo to be added (see Install package Application:Geo
# example for Leap 42 version:
sudo zypper addrepo https://download.opensuse.org/repositories/Application:Geo/openSUSE_Leap_42.3/Application:Geo.repo
sudo zypper refresh
RPM packages to be installed:
sudo zypper install bison flex freetype2-devel fftw3-devel gcc-c++ \
libgdal-devel libgeos-devel libjpeg-devel libpng-devel libtiff-devel \
man proj libproj-devel readline-devel netcdf-devel ncurses-devel \
mysql-devel postgresql-devel sqlite-devel unixODBC-devel \
tcl-devel tk-devel xorg-x11-Mesa-devel libXmu-devel \
python-numpy python-dateutil python-devel python-opengl \
python-wxWidgets python-xml python-dateutil wxWidgets-devel \
zlib-devel doxygen python-sphinx
Source code configuration:
./configure \
--enable-largefile \
--with-proj-share=/usr/share/proj \
--with-cxx \
--with-lapack=yes \
--with-motif \
--with-gdal=/usr/bin/gdal-config \
--with-postgres --with-postgres-includes=/usr/include/pgsql \
--with-mysql --with-mysql-includes=/usr/include/mysql \
--with-fftw \
--with-readline \
--with-netcdf \
--with-geos \
--with-nls \
--with-sqlite \
--with-freetype \
--with-freetype-includes=/usr/include/freetype2 \
--with-wxwidgets \
--with-odbc \
--with-python
Then compile with "make [-j2]".
RPM SPEC files
macOS
Compiling GRASS for macOS is not fundamentally different from for other *nix systems. It is on the contrary quite similar, but what differ is the lack of a default package management system for software GRASS depends on. This leaves the mac user to either: (1) compile the dependencies one-by-one; (2) compiling with one of the third-party package management systems avaliable; or (4) a combination thereof.
If you are interested in installing a precompiled version, please check out the official download site.
To date, maybe the easiest way to compile for Mac is by using GRASS app build script which is based on the instructions below for building using Anaconda. It will install dependencies, package and install an app bundle with just a command in Terminal.
Compilation and installation
For more up-to-date instructions please read:
- Compiling on macOS using Conda (Intel / Apple silicon based machine M1)
- Compiling on macOS using Anaconda
- Compiling on macOS using Homebrew
- Compiling on macOS using MacPorts
Legacy instructions
The following compilation and installation instructions are rather outdated as a whole. They do, however, contain parts and snippets that still may be very instructive and useful.
Troubleshooting:
- solving errors at starting GRASS: MacOSX GRASS errors
FreeBSD / NetBSD
The recommended compiler tools are GCC, GNU make, GNU coreutils (for install), and flex. All are available through the respective package managing tools (pkg_add for FreeBSD and pkgin install for NetBSD) and for recent *BSD versions most likely installed by default.
GRASS 8 should compile on FreeBSD and NetBSD.
It is highly recommended to install GDAL/OGR and PROJ first. These libraries and tools are available as ports for FreeBSD and packages for NetBSD.
Optional functionality is listed with ./configure --help, and related libraries and tools might need to be installed first.
You then may need to edit include/Make/Platform.make and set
ICONVLIB = -liconv
AIX
A recent GNU make (>= 3.81) and GNU coreutils are required. These are available with the IBM AIX toolbox or through third-party AIX software repositories, e.g. bullfreeware and perzl.org. Note that 'make' does not work, only 'gmake' works.
General instructions to compile on AIX are e.g. here
On AIX, compilation results by default in 32 bit applications and static libraries. The IBM documentation explains how to build 64 bit applications and shared libraries with GCC.
GRASS 8: Using the IBM xlc compiler:
Get and install (in this order):
- GNU tar
- GNU make (>= 3.81)
- SQLite
- PROJ.4 (for ./configure parameters, see here)
- GDAL (for ./configure parameters, see here)
- GRASS 8
The environment variables and configure command that worked:
## AIX 5.x export LIBPATH=/opt/freeware/lib64:/opt/freeware/lib # make 'ar' happy export OBJECT_MODE=64 PREFIX=$HOME/private/bin ./configure \ --prefix=$PREFIX \ --disable-shared \ --with-cxx \ --with-proj-includes=$PREFIX/include/ \ --with-proj-libs=$PREFIX/lib/ \ --with-proj-share=$PREFIX/share/proj/ \ --with-sqlite \ --with-sqlite-includes=$PREFIX/include/ \ --with-sqlite-libs=$PREFIX/lib/ \ --with-tiff=no \ --with-png=no \ --with-fftw=no \ --with-cairo=no \ --with-freetype=no
GRASS 8: Using the GNU gcc compiler:
Get and install (in this order):
- if needed, GNU tar
- if needed (the name is often 'gmake' and not 'make') GNU make (>= 3.81)
- SQLite
- PROJ.4 (for ./configure parameters, see here)
- GDAL (for ./configure parameters, see here)
- GRASS 8
The environment variables and configure command that worked for AIX 7.x:
## AIX 7.x export CC="gcc" export CXX="g++" PREFIX=$HOME/bin LDFLAGS="-Wl,-bsvr4,-R,/opt/freeware/lib -L/opt/freeware/lib" CPPFLAGS="-I/opt/freeware/include" ./configure \ --prefix=$PREFIX \ --enable-shared \ --with-includes=/opt/freeware/include --with-libs=/opt/freeware/lib \ --with-cxx \ --with-proj-includes=$PREFIX/include/ \ --with-proj-libs=$PREFIX/lib/ \ --with-proj-share=$PREFIX/share/proj/ \ --with-gdal=$PREFIX/bin/gdal-config \ --with-sqlite \ --with-sqlite-libs=$PREFIX/lib --with-sqlite-includes=$PREFIX/include \ --with-png=no \ --with-tiff=no \ --with-fftw=no \ --with-cairo=no \ --with-opengl=no \ --with-freetype=no
MS-Windows
See also WinGRASS Current Status for latest updates.
MS-Windows/native
GRASS on Windows using a standalone installer. It is still MinGW based (we are going to move this to CMake in 2024+).
Instructions to compile from source code:
MS-Windows/OSGeo4W
OSGeo4W is an installer for a broad set of open source geospatial software packages including GRASS as well as many other packages (QGIS, GDAL/OGR, and more).
- See OSGeo4W
MS-Windows/Cygwin
- See the Cygwin wiki pages
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
- error: g.list: error while loading shared libraries: libgdal1.6.0.so.1: cannot open shared object file: No such file or directory
- this error appears in the shell right after the user clicks GUI's "Start GRASS" button. The GUI shows an error about geographic extent and gets closed afterwards.
- It happens when you launch bin.i686 executable on 64bit system. Be careful and choose the right architecture.
- error: lib/python/ctypes
- This error appears during the compilation:
free(): invalid pointer Aborted (core dumped)
- It happens when you have multiple
libproj
versions on your system (check it with commandldd PATH_TO_GRASS_INSTALL/lib/libgrass_gproj.so | grep proj
- when this is not your problem, you should obtain exactly one result) - Solution: Try to reinstall
libproj-dev
andproj-data
- This error appears during the compilation:
Static compilation
In order to get static rather than dynamically linked binaries, configure like this:
./configure --disable-shared --enable-static
This will however break the wxGUI and GRASS 8 completely because "ctypes" wants to link against shared libs, or there is something in the static libs that "ctypes" does not like.
Optimization
GCC and other compilers support optimization
If you would like to set compiler optimisations, for a possibly faster binary, type (don't enter a ";" anywhere):
CFLAGS=-O ./configure
or,
setenv CFLAGS -O ./configure
whichever works on your shell. Use -O2 instead of -O if your compiler supports this (note: O is the letter, not zero). Using the "gcc" compiler, you can also specify processor specific flags (examples, please suggest better settings to us):
CFLAGS="-mcpu=athlon -O2" # AMD Athlon processor with code optimisations CFLAGS="-march=amdfam10" # AMD Phenom II X4 64bit processor with gcc >=4.3 CFLAGS="-mcpu=pentium" # Intel Pentium processor CFLAGS="-mcpu=pentium4" # Intel Pentium4 processor CFLAGS="-O2 -msse -msse2 -mfpmath=sse -minline-all-stringops" # Intel XEON 64bit processor CFLAGS="-mtune=nocona -m64 -minline-all-stringops" # Intel Pentium 64bit processor
To find out optional CFLAGS for your platform, enter:
gcc -dumpspecs
See also: https://gcc.gnu.org/
A real fast GRASS version (and small binaries) will be created with LDFLAGS set to "stripping" (but this disables debugging):
CFLAGS="-O2 -mcpu=<cpu_see_above> -Wall" LDFLAGS="-s" ./configure
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
Parallelized compilation on multi-core CPUs
You can dramatically accelerate the compilation of the GRASS code with the -j flag of "make" if you have a multi-core CPU system. This determines the maximum number of jobs to have running at once, so cores don't have to sit idle waiting for jobs on other cores to complete. A good rule of thumb for this value is number_of_cores * 1.5, but note that setting any higher than the actual number of cores will only affect the timing slightly. For example, on a dual-core processor:
make -j 4
GRASS-GDAL plugin
Addons
Please note that the installation of GRASS addons can be easily done with the g.extension manager. The compile instructions below are aiming at own development.
Compiled modules
This is the general way which works for C modules as well as scripts (Python or Shell/Bash modules) which has HTML documentation.
Requirements:
Either:
- a binary GRASS package, or
- source code which has been prepared with:
./configure [opionally flags] make libs
Each of the addon modules should come with a Makefile. To compile it, just run:
make MODULE_TOPDIR=/path/to/grass84/
Note that the /path/to/grass84 has to be absolute, not relative.
If using Bash it may be useful to set that up as an alias:
alias gmake64='make MODULE_TOPDIR=/path/to/grass84/'
Installation (perhaps requires "sudo"):
make MODULE_TOPDIR=/path/to/grass84/ install
Note: Compiled addons may require a re-compilation if you changed/updated your GRASS standard binaries.
If binary comes with a -dev package
(work in progress, this text states how it eventually will be :) Nowadays one does not need to the source code, nor compiling GRASS by oneself to be able to add add-ons. On Debian, you can just install the grass-dev package and then run:
make MODULE_TOPDIR=/usr/lib/grass84/ INST_DIR=/usr/lib/grass84/
The grass-dev package essentially provides GRASS's include header files and Make configuration files.
Scripts
If the addon module is a script, it is sufficient to copy it into the (GRASS binaries) path somewhere. Alternatively, install addons into a separate GRASS addons binaries/scripts directory which is easier to maintain. It avoids getting clobbered every time you reinstall GRASS. To use these separately stored scripts, set and export the GRASS_ADDON_PATH environment variable before starting GRASS and it will automatically be added to the module search path (see the variables help page). To simplify this, do for example:
# add in $HOME/.bashrc: GRASS_ADDON_PATH=/usr/local/grass/addons/ export GRASS_ADDON_PATH
Make sure that the script is executable, then just call it in GRASS typing the filename. Python scripts need to be called writing the extension as well, like:
GRASS (nc_spm):~ > v.krige.py