Post

GDAL, GEOS, PROJ installation from source code without sudo permission

🎀sqlite3

1
2
3
4
5
6
7
8
9
10
wget https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz
tar -xvzf sqlite-autoconf-3450100.tar.gz
cd sqlite-autoconf-3450100
./configure --prefix=/source/sqlite-autoconf-3450100
make -j 10 & make install

# ~/.bash_profile
export PATH=/source/sqlite-autoconf-3450100/bin:$PATH
export LD_LIBRARY_PATH=/source/sqlite-autoconf-3450100/lib
export LD_RUN_PATH=/source/sqlite-autoconf-3450100/lib

🎀Proj

🔗Proj page

Build requirements

  • C99 compiler
  • C++11 compiler
  • CMake >= 3.16 👉 cmake installation
  • SQLite3 >= 3.11: headers and library for target architecture, and sqlite3 executable for build architecture
  • libtiff >= 4.0 (optional but recommended) 👉 libtiff installation
  • curl >= 7.29.0 (optional but recommended)
  • JSON for Modern C++ (nlohmann/json) >= 3.7.0; if not found as an external dependency then vendored version 3.9.1 from PROJ source tree is used
1
2
3
4
gcc --version #C99 compiler
g++ --version #C++11 compiler
cmake --version #CMake
sqlite3 --version

Donwload

🔗Proj download page

1
wget https://download.osgeo.org/proj/proj-9.4.1.tar.gz

Installation

1
2
3
4
5
6
7
8
9
tar -xvzf proj-9.4.1.tar.gz
cd proj-9.4.1
mkdir build
cd build

cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_PREFIX_PATH="/sc/arion/projects/scMultiscale/chos14/source/tiff-4.6.0;/sc/arion/projects/scMultiscale/chos14/source/sqlite-autoconf-3450100" -DSQLite3_INCLUDE_DIR="/sc/arion/projects/scMultiscale/chos14/source/sqlite-autoconf-3450100/include" -DSQLite3_LIBRARY="/sc/arion/projects/scMultiscale/chos14/source/sqlite-autoconf-3450100/lib/libsqlite3.so" -DTIFF_INCLUDE_DIR="/sc/arion/projects/scMultiscale/chos14/source/tiff-4.6.0/include" -DTIFF_LIBRARY="/sc/arion/projects/scMultiscale/chos14/source/tiff-4.6.0/lib/libtiff.so" -DBUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=/sc/arion/projects/scMultiscale/chos14/source/proj-9.4.1 ..

cmake --build .
cmake --build . --target install

Update bash profile

1
2
3
4
PATH=/source/proj-9.4.1/bin:$PATH
export PROJ_DIR=/path/to/your/install/directory
export LD_LIBRARY_PATH=$PROJ_DIR/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$PROJ_DIR/lib/pkgconfig:$PKG_CONFIG_PATH

Check

1
2
3
4
5
proj --version
# Rel. 9.4.1, June 1st, 2024
# <proj>: 
# invalid option: --
# program abnormally terminated

🎀GDAL

🔗GDAL homepage

Build requirements

  • CMake >= 3.16, and an associated build system (make, ninja, Visual Studio, etc.)
  • C99 compiler
  • C++17 compiler since GDAL 3.9 (C++11 in previous versions)
  • PROJ >= 6.3.1

Donwload

🔗GDAL download page

1
wget https://github.com/OSGeo/gdal/releases/download/v3.9.1/gdal-3.9.1.tar.gz

Installation

1
2
3
4
5
6
7
tar -xvzf gdal-3.9.1.tar.gz
cd gdal-3.9.1
mkdir build
cd build
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/sc/arion/projects/scMultiscale/chos14/source/gdal-3.9.1 -DPROJ_INCLUDE_DIR=/sc/arion/projects/scMultiscale/chos14/source/proj-9.4.1/include -DPROJ_LIBRARY=/sc/arion/projects/scMultiscale/chos14/source/proj-9.4.1/lib64/libproj.so -DBUILD_TESTING=OFF ..
cmake --build .
cmake --build . --target install

Update bash profile

1
2
PATH=/source/gdal-3.9.1/bin:$PATH
export LD_LIBRARY_PATH=/source/gdal-3.9.1/lib64:$LD_LIBRARY_PATH

Check

1
2
gdal-config --version #GDAL
#3.9.1

🎀GEOS

🔗GEOS homepage

Build requirements

  • CMake 3.13 or later.
  • C++14 compiler. We regularly test GCC, Clang and Microsoft Visual C++.
  • Doxygen to build the API documentation.

Download

1
wget https://download.osgeo.org/geos/geos-3.12.2.tar.bz2

Installation

1
2
3
4
5
6
tar -xvf geos-3.12.2.tar.bz2
cd geos-3.12.2
mkdir _build
cd _build
cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/sc/arion/projects/scMultiscale/chos14/source/geos -DCMAKE_CXX_STANDARD=14 ..
make -j 10 & make install

Update bash profile

1
2
PATH=/source/geos/bin:$PATH
export LD_LIBRARY_PATH=/source/geos/lib64:$LD_LIBRARY_PATH

Check

1
2
geos-config --version #GEOS
#3.12.2
This post is licensed under CC BY 4.0 by the author.

© Subin Cho. Some rights reserved.

Using the Chirpy theme for Jekyll.