inbo/inborutils

Travis CI error: compilation failed for package ‘rgdal’

Closed this issue · 10 comments

After reverting the one line commit I erroneously pushed to master, Travis CI fails to build inborutils due to compilation failure: compilation failed for package ‘rgdal’. Build: https://travis-ci.com/github/inbo/inborutils
Any idea?
By the way, I was constantly experiencing this failure compiling rgdal even yesterday while working on branch setup_codingclub_session. So, it seems this failure has nothing to do with any development I was doing yesterday, which indeed didn't include any use of rgdal.

Maybe it is something related to the latest Ubuntu, Xenial: see travis-ci/travis-ci#5821

After some more research, I found some more recent issues specifically gdal related:

travis-ci/travis-ci#5852 and pfmc-assessments/geostatistical_delta-GLMM#38 (comment)
Following the link to solving commit in the second issue, I see the following lines being added:

before_install:
  - sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable --yes
  - sudo apt-get --yes --force-yes update -qq
  - sudo apt-get install --yes libudunits2-dev libproj-dev libgeos-dev libgdal-dev

while removing the apt_packages section.

I will give a try in this branch.

It seems it doesn't solve the problem. Here the link to the Travis's failed build:
https://travis-ci.com/github/inbo/inborutils/jobs/368568380

I'm having the same issue on my package with rgdal. The following solution does not seem to work either:

before_install:
  - R -e 'install.packages("rgdal", repos=c("http://R-Forge.R-project.org", "http://cran.rstudio.com"))'

The following solution does not work either for me:

before_script:
  - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then R -e "install.packages('rgdal', type = 'source')"; fi

In my case, it seems like rgdal is being only successfully installed only on windows, but failing in mac and linux:

checking for gdal-config... no
no
configure: error: gdal-config not found or not executable.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/Users/runner/work/_temp/Library/rgdal’

The downloaded source packages are in
	‘/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/Rtmp16eRHy/downloaded_packages’
Warning message:
In i.p(...) : installation of package ‘rgdal’ had non-zero exit status

Thanks @YuriNiella for your input. @florisvdh, I know you are a fervent Linux user, how do you get rgdal installed on your laptop? Probably an older Ubuntu version?

Sorry, I overlooked your question @damianooldoni . I'll try to have a further look at the problem this week. Meanwhile: perhaps something similar as explained in #81 (comment)?

In response to your question: rgdal for Linux does not have gdal included; it binds to the gdal library which must first be present on the system. The latter is done by this line - i.e. the gdal development package on Ubuntu (which will draw in some other packages as well) - all precompiled Ubuntu packages. [rgdal on my laptop just installs like any R-package that is compiled at installation time, as will happen here - on condition gdal is present already].

Note that the referred comment relates to a previous state of the yml, which installed the precompiled Linux package r-cran-rgdal - but it had an unwanted dependency on another R version which caused problems in the build. Before, r-cran-rgdal may have been chosen to speed things up (no R package compilation), but actually the speed-up is one-time-only-merit per R version on Travis, as it uses a cache.

This is how I install rgdal in the Rstable docker image: https://github.com/inbo/Rstable/blob/6ac49b53d3d0b2422caa3598d4699cfaf621d881/Dockerfile#L275
The cran_install is a bash script to install a specific version of a package. You can use install.packages("rgdal") instead.

@damianooldoni the cause is a CRAN version of rgdal which erroneously did not build against older versions of GDAL/PROJ; see this post of R. Bivand. However in the meantime this has been solved in the current CRAN version; just re-running the Travis build should succeed - see the successful Travis builds of the (experimental) travis_tweak branch.

Given the fact that we can expect this to happen more in the future (as warned for in the referenced post):

  • we should be able to move on and get GDAL 3 / PROJ >= 6 on Travis - meaning that we need Ubuntu Bionic at least
    • a question has been posted on that here. It refers to the travis_tweak branch, so we better still leave it there for a while. Note that, if indeed the unstable PPA would be added for the Bionic build environment (instead of the stable one), no manual tinkering as in here will be needed.
  • for now, while all is OK on master, I've sent a PR #90 which just works as well and which will be bionic- and focal-compliant considering the libgdal-dev package name. I believe libgdal1-dev still stems from Trusty (Ubuntu 14.04).

Thanks @ThierryO and @florisvdh for your inputs. Indeed, I can confirm that the problem has been solved on my branch as on master as reported by @florisvdh. I think we can close this issue. Discussion can be continued, if needed on PR #90.