GDAL on Travis

Frustrations around finding helpful articles have led to this writing. The steps follow an error reproduction to a solid solution for the issue.

The GDAL version installed on the chosen machine must match the package library version installed into your project. Example, glad-config -v == pip freeze | grep GDAL.

The project runs python3.7 and requires a GDAL version == 2.4.2, though > 2.2.0 would not break it.

At the time of this writing, travis supports the following distros:

  • precise - Ubuntu 12.04
  • trusty - Ubuntu 14.04
  • xenial - Ubuntu 16.04
  • bionic - Ubuntu 18.04

Xenial is set as the default distro.

In the first configuration, xenial distribution is used. Ubuntu 16.04. The package libgdal-dev in xenial is 1.11.3+dfsg-3build2. See this package list.

To get the latest releases for Ubuntu GIS packages, the source from ubuntugis: ubuntugis/ubuntugis-unstable attempts is added. Now later versions can be pulled and installed.

However, this build fails, the source is not whitelisted:

There exists an open issue on the travis-ci repo on this.

The second configuration, bionic distribution is used instead. The package libgdal-dev in bionic is 2.2.3+dfsg-2.

An error is noticed in the build.

The build defaults to Ubuntu xenial. Looking through possible solutions on forums, downing the python version to 3.6 still produces the same issue.

There are successful builds running on bionic.
If you can run on bionic and this fills your requirements.. You can exit() :)

This however remains an issue in this build at the time of writing this. If you have a workaround, solution,, feel free to comment links to the same.

Workaround

The next resolve is to download the source from OSGEO and build the specific GDAL version.

GDAL is dependent on proj which also is installed and built.

Credit to these modified scripts go to @rbuffat to Toblerity/Fiona.. who contributed the original script.

This takes a while, but guarantees the specific version is built on the machine.

The travis configuration for this:

To save on the make install time during every build, the GDAL installations are cached.

In retrospect, this approach is much better to use. It gives you control over the specific versions of GDAL you want to use while maintaining whatever distro you have. Also, you can matrix(like in the original script) and have different versions for different cases.

MicroCorruption: Sydney

AH19CTF WriteUps: Command Parser

comments powered by Disqus