1

There are a lot of questions like this on stack already... I have found quite a few, but it doesnt resolve my problem.

These are the things that I have tried thusfar. Going to the CRAN website cran.r-project.org/web/packages/rgdal/index.html

we see that in order to build this package, we need

  • GDAL >= 1.6.3, library from trac.osgeo.org/gdal/wiki/DownloadSource and
  • PROJ.4 (proj >= 4.4.9) from download.osgeo.org/proj/; 

Further, we need the dependencies

  • Depends: R (≥ 3.3.0), methods, sp (≥ 1.1-0)

But these are already installed.

We have already installed the system dependencies, since

[]$ gdal-config --version
2.1.3
[]$ proj
Rel. 4.4.9, 29 Oct 2004
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]

However, when we try to install the package by

install.packages("rgdal_1.2-5.tar.gz",type = "source",repos = NULL,
configure.args=c('--with-proj-include=/usr/local/include','--with-proj-lib=/usr/local/lib'))

The configure.args options are from the answers give in rgdal package installation

However we still get an error when installing... this is a part of the log

    *** installing help indices
      converting help for package ‘rgdal’
        finding HTML links ... done
        CRS-class                               html
        GDALDataset-class                       html
        GDALDriver-class                        html
        GDALMajorObject-class                   html
        GDALRasterBand-class                    html
        GDALReadOnlyDataset-class               html
        GDALReadOnlyDataset-methods             html
        GDALTransientDataset-class              html
        GridsDatums                             html
        RGB2PCT                                 html
        SGDF2PCT                                html
        SpatialGDAL-class                       html
        closeDataset-methods                    html
        displayDataset                          html
        llgrid                                  html
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/llgrid.Rd:11: missing file link ‘Spatial’
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/llgrid.Rd:16: missing file link ‘gridat’
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/llgrid.Rd:17: missing file link ‘gridat’
        make_EPSG                               html
        nor2k                                   html
        projInfo                                html
        project                                 html
        readGDAL                                html
    Rd warning: /tmp/RtmppvlZ6x/R.INSTALL233feb7dc50/rgdal/man/readGDAL.Rd:136: missing file link ‘flipVertical’
        readOGR                                 html
        showWKT                                 html
        spTransform-methods                     html
        wrappers                                html
        writeOGR                                html
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded
    Error in dyn.load(file, DLLpath = DLLpath, ...) :
      unable to load shared object '/usr/lib64/R/library/rgdal/libs/rgdal.so':
      libgdal.so.20: cannot open shared object file: No such file or directory
    Error: loading failed
    Execution halted
    ERROR: loading failed
    * removing ‘/usr/lib64/R/library/rgdal’
    Warning message:
    In install.packages("rgdal_1.2-5.tar.gz", type = "source", repos = NULL) :
      installation of package ‘rgdal_1.2-5.tar.gz’ had non-zero exit status

Note that the warnings that are triggered here are apparantly no show stopper (as said on https://groups.google.com/forum/#!topic/batchjobs/TvwTbqrWFyU) So it seems that the system dependencies (GDAL and PROJ) are both met... the package dependencies (methods, sp) are there as well. However, the installation is unable to location certain files.. I know from stackoverflow and such that you can give certain arguments to the install.packages() command of R... like shown in the code snippet above.. so it might be that Im not specifying enough paths... or its something else

Atlast, the location of gdal and proj on the old edgenode is given by

  • gdal : /usr/local/lib/libgdal.so.20
  • proj : /usr/local/lib/libproj.so.0 11:26:32

Can you guys give any hint on where to go from here?

Community
  • 1
  • 1
zwep
  • 1,207
  • 12
  • 26

1 Answers1

0

I faced the same problem and in another thread for Ubuntu the answer was that which rgdal-config gave two installation points and that was wrong so he uninstalled one. On another thread the solution was installing libgdal-dev since they are needed to install from source.

I am on Arch Linux and so none of these were answers for me.

I did, though, find that for libgdal-dev an AUR package "python-gdal" gave me the needed deps but what was critical was that an optional dependecy of rgdal (which had installed without problem for me) was mariadb. In the errors you can see that it fails communicating with mysql_client18..

So I installed maria db, sudo pacman -S mariadb and I could finally install r-cran-gdal for R. The PKGBUILD for r-cran-gdal is not up to date on AUR, but manually editing the PKGBUILD and makepkg -si finally worked.