[R-pkg-devel] Finding/specifying Installation path of gdal in a travis-ci build

Lorenzo Busetto lbusett at gmail.com
Tue Dec 19 14:45:02 CET 2017


​​
(crossposting from StackOverflow -
https://stackoverflow.com/q/47884874/6871135)

Dear all,

 in a package I am maintaining (https://github.com/lbusett/MODIStsp), I use
the `gdalUtils` package as a wrapper to
​ ​
​call​

gdal processing ​
utilities. The problem is that I can not find a way to run my test suite
and examples on TRAVIS-CI. This appears
​ ​
to
​ ​
be related to the fact that the gdal installation folder is not found on
the path, so that I receive the following
​ ​
error:

> Warning in gdalUtils::gdal_setInstallation(ignore.full_scan = TRUE)
> No GDAL installation found. Please install 'gdal' before continuing:
> - www.gdal.org (no HDF4 support!)
> - www.trac.osgeo.org/osgeo4w/ (with HDF4 support RECOMMENDED)
> - www.fwtools.maptools.org (with HDF4 support)

(see here for the full build log:
https://travis-ci.org/lbusett/MODIStsp/jobs/318037312)

`gdalUtils::gdal_setInstallation()` is supposed to search for a
​ ​
valid gdal installation, by first using sys.which(), and (in
​ ​
case it fails) looking on "typical" installation paths (see
https://www.rdocumentation.org/packages/gdalUtils/versions/2.0.1.7/topics/gdal_setInstallation
).

This happens besides gdal (apparently) being installed on travis in the
build, using the following travis.yml configuration:

language: r
cache: packages

warnings_are_errors: false

​​
before_install:
  - sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
  - sudo add-apt-repository -y ppa:opencpu/jq --yes
  - sudo apt-get -qq update
  - sudo apt-get install -y libgdal-dev libproj-dev
  - PATH="/usr/local/gdal/bin:$PATH"
  - export DISPLAY=:99.0
  - sh -e /etc/init.d/xvfb start

matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      env:
        global:
          - R_LIBS="http://cran.rstudio.com"
          - R_BUILD_ARGS="--no-build-vignettes --no-manual"
          - R_CHECK_ARGS="--no-build-vignettes --no-manual --as-cran"
          - R_CHECK_TIMINGS_="0"
          - BOOTSTRAP_LATEX="1"
      apt_packages:
            - libgdal-dev
            - libproj-dev
            - libcairo2-dev
            - libatk1.0-dev
            - libpango1.0-dev
            - libgtk2.0-dev
            - libglib2.0-dev
            - libcurl4-openssl-dev
      r_binary_packages:
        - cairoDevice
        - RGtk2

Do you have any suggestions to solve the issue? Do I need to somehow set
the PATH to gdal in the travis.yml script? If so, how could I find out
where gdal is being installed? (
I already
​ ​
tried adding a line like
​
- PATH="/usr/local/gdal/bin:$PATH"
​ ​
in
​
​
before_install
​ within​
​
the yml but it did not work).

Thanks in advance for any help!

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list