4

Hello I have a problem when I try to install RGDAL. If found other posts with similar problems, but the solutions were always limited to Debian distributions, can you help me on CentOs?

This is the error I have when running the following command in RStudio: > install.packages("rgdal", dependencies = T)

Installing package into ‘/home/dial/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.2-13.tar.gz'
Content type 'application/x-gzip' length 1648119 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
configure: rgdal: 1.2-13
checking for /usr/bin/svnversion... no
configure: svn revision: 686
checking for gdal-config... /home/dial/anaconda2/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.1.0
checking GDAL version >= 1.6.3... yes
checking gdal: linking with --libs only... no
checking gdal: linking with --libs and --dep-libs... no

followed by a bunch of lines like this one:

/usr/bin/ld: warning: libnetcdf.so.11, needed by /home/dial/anaconda2/lib/libgdal.so, not found (try using -rpath or -rpath-link)

and finally:

collect2: error: ld returned 1 exit status
configure: Install failure: compilation and/or linkage problems.
configure: error: GDALAllRegister not found in libgdal.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/home/dial/R/x86_64-redhat-linux-gnu-library/3.4/rgdal’
Warning in install.packages :
  installation of package ‘rgdal’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp8UHPBS/downloaded_packages’

This is done on a server, running on CentOS. I guess the following info might be helpful:

$ gdal-config --version 
2.1.0
$ which gdal-config 
~/anaconda2/bin/gdal-config
$ gdal-config --libs 
-L/home/dial/anaconda2/lib -lgdal

Can you help me with this installation?

  • Where did you install GDAL 2.1.0 from? Was it installed with RPM? Does `rpm -q --whatprovides /usr/lib64/libgdal.so` return a package name? – Dima Chubarov Oct 24 '17 at 06:29
  • AFAIK, EPEL has GDAL 1.11.4 at the moment – Dima Chubarov Oct 24 '17 at 06:38
  • @DmitriChubarov this is the returned package: gdal-devel-1.11.4-10.rhel7.x86_64 Unfortunately I did not install GDAL myself and I am not an expert on CentOs, I guess the best I can do is to run any command you need. – Jonathan Frisch Oct 24 '17 at 10:05
  • You seem to have two versions of `gdal` on your system. One provided by Anaconda, another - provided by CentOS. The two were compiled against different versions of NetCDF library. I assume getting rid of Anaconda is not an easy option. Neither is stripping CentOS installation of its packages. The remaining option is to try to stay with Anaconda without getting CentOS involved. Try `/home/dial/anaconda2/bin/conda install -c anaconda netcdf4` to get netcdf installed in conda and `/home/dial/anaconda2/bin/conda upgrade gdal` to upgrade gdal to the latest version. If successful reinstall rgdal. – Dima Chubarov Oct 24 '17 at 14:04
  • 1
    Thanks for the help @DimitriChubarov , unfortunately it did not solve the problem. What finally worked - and I really don't understand why - is `conda remove libgdal` – Jonathan Frisch Oct 25 '17 at 15:18

0 Answers0