Skip to content

Instantly share code, notes, and snippets.

@emxsys
Created January 9, 2019 15:34
Show Gist options
  • Select an option

  • Save emxsys/a130fe9374699bda440dad09e43d725a to your computer and use it in GitHub Desktop.

Select an option

Save emxsys/a130fe9374699bda440dad09e43d725a to your computer and use it in GitHub Desktop.
Build GDAL 2.2.2 with ECW on Ubuntu
#!/bin/bash
# ===============================================================================
# GDAL 2.2.2 build instructions with ECW on Ubuntu
# ===============================================================================
# Downloads: http://download.osgeo.org/gdal
# - wget http://download.osgeo.org/gdal/2.2.2/gdal-2.2.2.tar.gz
rm -r gdal-2.2.2
tar -xzvf gdal-2.2.2.tar.gz
cd gdal-2.2.2
installpath=/usr/local/gdal-2.2.2
ecwjp2path=/usr/local/lib/libecwj2-3.3
# Set the 'threads' variable to the computer's # of cpu threads+1
threads=`expr \`cat /proc/cpuinfo |grep -i 'core id'|wc -l\` \+ 1`
# then use 'make -j' option to compile all software (e.g. make -j9 on an 8-thread CPU)
# e.g., make -j$threads
# Prerequisites:
# - See: http://scigeo.org/articles/howto-install-latest-geospatial-software-on-linux.html#gdal
# basic dependencies (enough to build GDAL)
echo Installing prerequisite packages
echo ================================
sudo apt-get install g++ libxml2-dev python-dev python-numpy swig libexpat1-dev libgdal-dev
echo Configuring build
echo =================
./configure \
--prefix=${installpath} \
--with-ecw=${ecwjp2path} \
--with-python \
--with-java
echo Starting the compile
echo ====================
make -j$threads
echo Installing the build
echo ====================
sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment