Use your package manager to install the following packages and development packages:
Optional:
Note: in order to compile optional SAGA tool libraries, which depend on these additional libraries, you have to install the libraries and their development packages on your build system with the system's package manager before configuring and building SAGA.
Most of the optional tool libraries will be build automatically once their dependencies are detected while configuring the build (see below), including
Others can be enabled by passing their flags to the cmake configure call, e.g.
You can use the following commands to install all required dependencies:
Fedora
dnf install wxGTK-devel proj-devel gdal-devel libtiff-devel unixODBC-devel
openSUSE
For some dependencies (e,g.gdal) the Application:/Geo repository has to be enabled.
zypper ar http://download.opensuse.org/repositories/Application:/Geo/openSUSE_12.1/ GEO
Now the packages can be installed.
zypper install wxWidgets-devel libproj-devel libgdal-devel libtiff-devel
Debian / Ubuntu
apt-get install ibwxgtk3.0-gtk3-dev libtiff5-dev libgdal-dev libproj-dev \
libexpat1-dev wx-common libogdi-dev unixodbc-dev
For Ubuntu versions <22.10 (Kinetic Kudu) or Debian 11 stable (bullseye) are no wxWidgets/wxGTK greater 3.0.5 (necessary for SAGA > 7.2.0) available. Please consider using a third party PPA like CodeLite.
Install the necessary dependencies from the official repository:
apt-get install libtiff5-dev libgdal-dev libproj-dev libexpat1-dev libogdi-dev unixodbc-dev
Install wxWidgets from the PPA. Please change jammy
according to your Ubuntu Release following this page:
apt-add-repository 'deb https://repos.codelite.org/wx3.2/ubuntu/ jammy universe'
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6856E1DB1AC82609
apt update
apt install libwxbase3.2-0-unofficial libwxbase3.2unofficial-dev libwxgtk3.2-0-unofficial libwxgtk3.2unofficial-dev wx3.2-headers wx-common
Arch
Installing packages to be able to build .
pacman -S base-devel cmake
Installing the necessary packages.
pacman -S wxwidgets-gtk3 libtiff gdal pdal proj opencv unixodbv
Installing the optional packages
pacman -S swig libharu liblas libsvm vigra
SAGA uses cmake for configuration and building. The automake build system was removed after the release of SAGA version 8.2 (scroll down for instructions on how to use the automake build system to build older SAGA versions).
Use your package manager to install the following tools:
You can use the following commands to install all needed tools:
Fedora
dnf install gcc gcc-c++ cmake cmake-gui make libtool git
openSUSE
zypper install gcc-c++ cmake cmake-gui make git
Ubuntu
apt-get install g++ cmake cmake-qt-gui make libtool git
Create the directory you like to download the sources to and change to that directory, e.g.
mkdir /home/devel
cd /home/devel
Check out the git repository with:
git clone git://git.code.sf.net/p/saga-gis/code saga-gis-code
Change to the source directory, e.g.
cd /home/devel/saga-gis-code
Create a build directory, e.g.
mkdir build
Change to the build directory, e.g.
cd build
Configure the build (note: unexperienced users might be better off using cmake-gui for the configuration, see below), e.g.
cmake ../saga-gis -DCMAKE_BUILD_TYPE=RELEASE -DWITH_TRIANGLE=OFF -DWITH_SYSTEM_SVM=ON -DWITH_DEV_TOOLS=OFF
Note: depending on your system setup, the first configuration run may not have found all required dependencies; in this case you should follow the hints that were printed by the first run, e.g. to simply re-run the cmake call. In some cases it might be necessary to explicitly pass arguments to the cmake call for some of the components to be configured. Such a call might look like this for example:
cmake ../saga-gis -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_RPATH=/usr/local/lib -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib64/libpython3.6m.so -DPYTHON_EXECUTABLE=/usr/bin/python3.6 -DWITH_TRIANGLE=OFF -DWITH_SYSTEM_SVM=ON -DWITH_TOOLS_VIGRA=OFF -DWITH_DEV_TOOLS=ON -DSVM_INCLUDE=/usr/include/libsvm/svm.h
You can print all available configuration options with
cmake -LA
or more verbose with
cmake -LAH
You can also use cmake-gui to configure the build, this is sometimes easier for unexperienced users. Run
cmake-gui
Then
Now compile SAGA with
cmake --build . --config Release
To install SAGA, get superuser/root privileges (with sudo su or appropriate command) and run
cmake --install .
Note: on some systems it might be necessary to run "sudo ldconfig" before saga_gui or saga_cmd can be executed.
To start the graphical user interface of SAGA, just enter
saga_gui &
If the SAGA tool libraries are not loaded automatically, you can load them with the "Geoprocessing > Load Tool Library" menu entry.
To run the SAGA command line interpreter enter
saga_cmd
In case you like to use tool libraries that are not located within the SAGA installation folder, you can specify the environment variable "SAGA_TLB" and let it point to the folder of these tool libraries:
export SAGA_TLB=/usr/local/lib/my_tools
Note: the automake build system is only available in SAGA versions < 8.3.0.
Compilation and configuration tools needed
Compiling SAGA
Change to the source directory, e.g.
cd /home/devel/saga-gis-code/saga-gis
Try a
autoreconf -fi
In case this is not working with your Linux distribution, take the long way:
aclocal
autoheader
libtoolize
automake --add-missing
autoconf
Now compilation should be straightforward with
./configure
make
In case you like to build also the SAGA API python interface, run
./configure --enable-python
before doing make. Note that you require to install the SWIG compiler to build the python interface!
Note: there are further configure options which can be listed with
./configure --help
To install SAGA, get superuser/root privileges (with sudo su or appropriate command) and run
make install
Wiki: Compiling SAGA on Linux (outdated)
Thanks for this useful page. I had to run "sudo ldconfig" after compiling to be able to run SAGA.
Thanks, I've added a note.
Last edit: Volker Wichmann 2018-03-16
Hi Markus,
I saw your latest changes:
It is really welcome that this page gets updates, but I'm not sure if we should really add this. First of all there are already distributions out there that come with python 3. And next, it is quite dangerous for unexperienced users to install an alternative python package on their system. I have done this on my system in order to test a build with python 3, but I have to revert it after that because otherwise my package manager etc. stops working (as it is expecting python 2).
So if we really want add such a note, I think we should formulate it differently. What do you think?
Hi Markus,
since I didn't hear from you, I've reverted the change as the note is still available here in the discussion.
On a fresh install of ubuntu 24.04 - I get this error -
https://packages.ubuntu.com/search?keywords=pdal seems to indicate that pdal is missing?
or did i get something else wrong?
Please don't use the wiki to ask questions, such topics are better discussed in the forums.
Seems like there is no PDAL package available for Ubuntu 24.04 yet, so you should disable the build of the io_pdal tool library. Configure cmake with
-DWITH_TOOLS_PDAL=OFF