Compile and Install With CMake
Disclaimer: As of Spring 2025, the development of GRASS GIS using CMake is ongoing. Both the functionality of the CMake build system and the content of this documentation are subject to change.
Building With CMake
It is strongly recommended to perform the build process with CMake in a separate directory, as opposed to the traditional approach of running `./configure && make` in the top-level directory of the source repository using Autotools. The designated build directory may be located anywhere.
A simple configuration, which creates a build directory named "build" (with -B argument) with current directory as source directory (with -S), can look like this:
cd grass_source_dir cmake -B build -S .
Executing the building process is made with:
cmake --build build
A custom configuration may look like:
export CFLAGS="-DGL_SILENCE_DEPRECATION" cd grass_source_dir cmake -B build -S . -G Ninja \ -DCMAKE_PREFIX_PATH="/opt/local" \ -DWITH_OPENMP=ON cmake --build build -v -j8
To clean up the configuration and build files (equivalent to `make distclean`):
cd grass_source_dir rm -rf build
Install:
cmake --install build
It is possible to run GRASS for testing purposes in build directory:
./build/output/bin/grass
Required Software for GRASS
Required software to build GRASS:
- Bison
- CMake (version 3.22+)
- flex
- GDAL
- PCRE (required for MSVC only, on *NIX based platforms the Regex library is part of the system)
- PROJ
- Python (version 3.9+)
- zlib
Optional Software and Configuration Flags
Software | Flag (BOOL) | Default |
---|---|---|
bzip2 | WITH_BZLIB | OFF |
Cairo | WITH_CAIRO | ON |
CBLAS | WITH_CBLAS | ON |
FFTW | WITH_FFTW | ON |
FreeType | WITH_FREETYPE | ON |
GEOS | WITH_GEOS | ON |
LAPACKE | WITH_LAPACKE | ON |
libLAS | WITH_LIBLAS | OFF |
libpng | WITH_LIBPNG | ON |
LibTIFF | WITH_TIFF | ON |
MySQL | WITH_MYSQL | OFF |
NetCDF | WITH_NETCDF | OFF |
ODBC | WITH_ODBC | OFF |
OpenGL | WITH_OPENGL | ON |
OpenMP | WITH_OPENMP | OFF |
PDAL | WITH_PDAL | ON |
PostgreSQL | WITH_POSTGRES | ON |
Readline | WITH_READLINE | ON |
SQLite | WITH_SQLITE | ON |
X11 | WITH_X11 | ON/OFF* |
Zstandard | WITH_ZSTD | ON |
Description | Flag (BOOL) | Default |
---|---|---|
Build documentation | WITH_DOCS | ON |
Install according to Filesystem Hierarchy Standard (FHS) | WITH_FHS | OFF |
Build GUI | WITH_GUI | ON |
Large file support | WITH_LARGEFILES | ON/OFF* |
Build with National Language Support (NLS) | WITH_NLS | ON/OFF* |
Use Ccache | USE_CCACHE | ON |
- ) the default setting varies by platform.
Configuration Options
bzip2 (-DWITH_BZLIB)
bzip2 is a freely available high-quality data compressor.
The library is used by: GRASS General Library (GRASS GIS Library).
Cairo (-DWITH_CAIRO)
Cairo is a 2D graphics library with support for multiple output devices.
The library is used by: GRASS Cairo Display Driver and `g.cairocomp`.
CBLAS (-DWITH_CBLAS)
CBLAS C interface to the BLAS (Basic Linear Algebra Subprograms) which are routines that provide standard building blocks for performing basic vector and matrix operations.
The library is used by: GRASS numerical math interface (GRASS Math Library).
FFTW (-DWITH_FFTW)
FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data.
The library is used by: GRASS numerical math interface (GRASS Math Library), `i.fft` and `i.ifft`.
FreeType (-DWITH_FREETYPE)
FreeType is a freely available software library to render fonts.
The library is used by: GRASS Display Driver, GRASS Cairo Display Driver and `v.label.sa`.
GEOS (-DWITH_GEOS)
GEOS is a C/C++ library for computational geometry with a focus on algorithms used in geographic information systems (GIS) software.
The library is used by: `v.buffer`, `v.profile` and `v.select`.
LAPACKE (-DWITH_LAPACKE)
LAPACKEis the C Interface to LAPACK, the Linear Algebra PACKage.
The library is used by: GRASS Vector Library, GRASS numerical math interface (GRASS Math Library) and GRASS Raster Library
libLAS (-DWITH_LIBLAS)
libLAS is a C/C++ library for reading and writing the very common LAS LiDAR format.
The library is used by: `r.in.lidar`, `r3.in.lidar`, `v.in.lidar`, `v.lidar.correction`, `v.lidar.edgedetection`, `v.lidar.growing` and `v.out.lidar`.
libpng (-DWITH_LIBPNG)
libpng provides support for Portable Network Graphics (PNG) image file format.
The library is used by: GRASS PNG Display Driver Library, `r.in.png` and `r.out.png`.
LibTIFF (-DWITH_TIFF)
LibTIFF provides support for the Tag Image File Format (TIFF), a widely used format for storing image data.
The library is used by: GRASS OGSF Library.
MySQL (-DWITH_MYSQL)
MySQL or MariaDB are two forks of a relational database.
The library is used by: GRASS DataBase MySQL driver.
NetCDF (-DWITH_NETCDF)
NetCDF (Network Common Data Form) is a set of software libraries and machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data.
The library is used by: `r3.out.netcdf`.
ODBC (-DWITH_ODBC)
Open Database Connectivity (ODBC) is a standard application programming interface (API) for accessing database management systems (DBMS).
The library is used by: GRASS DataBase ODBC driver.
OpenGL (-DWITH_OPENGL)
OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics.
The library is used by: GRASS OGSF Library and GRASS Nviz Library.
OpenMP (-DWITH_OPENMP)
OpenMP is an application programming interface (API) that supports multi-platform shared-memory multiprocessing programming in C, C++, and Fortran, on many platforms, instruction-set architectures and operating systems.
The library is used by: GRASS numerical math interface (GRASS Math Library), GRASS Partial differential equations Library (GPDE), GRASS Library for interpolation with regularized splines with tension (RST), `r.mfilter`, `r.neighbors`, `r.proj`, `r.resamp.filter`, `r.resamp.interp`, `r.series`, `r.series.accumulate`, `r.slope.aspect`, `r.sun`, `r.sim`, `r.univar`, `r3.univar` and `v.surf.rst`.
PDAL (-DWITH_PDAL)
PDAL is a C++ library for translating and manipulating point cloud data.
The library is used by: `r.in.pdal` and `v.in.pdal`.
PostgreSQL (-DWITH_POSTGRES)
PostgreSQL is a powerful, open source object-relational database system.
The library is used by: GRASS DataBase PostgreSQL driver, GRASS General Library (GRASS GIS Library), `v.external` and `v.out.postgis`.
Readline (-DWITH_READLINE)
Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in.
The library is used by: `r.mapcalc` and `r3.mapcalc`.
SQLite (-DWITH_SQLITE)
SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine.
The library is used by: GRASS DataBase SQLite driver and `g.version`.
X11 (-DWITH_X11)
X Window System (X11) is a windowing system for bitmap displays, common on Unix-like operating systems.
The library is used by: GRASS Nviz Library, `g.cairocomp` and `ximgview`.
Zstandard (-DWITH_ZSTD)
Zstandard is a fast compression algorithm, providing high compression ratios. It also offers a special mode for small data, called dictionary compression.
The library is used by: GRASS General Library (GRASS GIS Library).
Build documentation (-DWITH_DOCS)
Install according to Filesystem Hierarchy Standard (FHS) -(DWITH_FHS)
Build GUI (-DWITH_GUI)
Large file support (-DWITH_LARGEFILES)
Build with National Language Support (-DWITH_NLS)
Requires: Gettext
Use Ccache (-DUSE_CCACHE)
Ccache is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.
Requires: Ccache