Skip to content

Trouble installing rgdal

13 messages · Bennet Fauber, Roger Bivand, Thomas Adams

#
Hi all,

I have searched the internet and have spent a few days trying to get to the
problem when I try to install rgdal into my Ubuntu 18.04 system. I have
done this many times previously, but cannot seem to track down what I am
doing wrong now. I have tried a forced install from sources with and
without dependencies. Below is what I get. Any help is appreciated.

Tom
Installing package into ?/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0?
(as ?lib? is unspecified)
trying URL 'https://cran.case.edu/src/contrib/rgdal_1.5-12.tar.gz'
Content type 'application/x-gzip' length 2302403 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

* installing *source* package ?rgdal? ...
** package ?rgdal? successfully unpacked and MD5 sums checked
** using staged installation
configure: R_HOME: /usr/local/lib/R
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
configure: CXX11 is: g++, CXX11STD is: -std=gnu++11
configure: CXX is: g++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.5-12
checking for /usr/bin/svnversion... yes
configure: svn revision: 1018
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.0.0
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /usr/local/share/gdal/stateplane.csv readable... yes
configure: pkg-config proj exists, will use it
configure: PROJ version: 6.1.0
configure: PROJ CPP flags: -DPROJ_H_API -I/usr/local/include
configure: PROJ LIBS: -L/usr/local/lib -lproj
checking PROJ header API:... yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking proj.h usability... yes
checking proj.h presence... yes
checking for proj.h... yes
checking for proj_context_create in -lproj... yes
checking Using GDAL < 3 with PROJ >= 6... no
checking PROJ version >= 4.8.0... yes
checking PROJ: proj.db found and readable... yes
configure: Package CPP flags:  -I/usr/local/include -I/usr/local/include
-DPROJ_H_API
configure: Package LIBS:  -L/usr/local/lib -lgdal -L/usr/local/lib -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c OGR_write.cpp -o OGR_write.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c gdal-bindings.cpp -o
gdal-bindings.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c init.c -o init.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c inverser.c -o inverser.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c local_stubs.c -o local_stubs.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogr_geom.cpp -o ogr_geom.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogr_polygons.c -o ogr_polygons.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogr_proj.cpp -o ogr_proj.o
ogr_proj.cpp: In function ?SEXPREC* R_GDAL_OSR_PROJ()?:
ogr_proj.cpp:163:9: error: ?OSRGetPROJVersion? was not declared in this
scope
         OSRGetPROJVersion(&pnMajor, &pnMinor, &pnPatch);
         ^~~~~~~~~~~~~~~~~
ogr_proj.cpp:163:9: note: suggested alternative: ?OSRProjVersion?
         OSRGetPROJVersion(&pnMajor, &pnMinor, &pnPatch);
         ^~~~~~~~~~~~~~~~~
         OSRProjVersion
/usr/local/lib/R/etc/Makeconf:176: recipe for target 'ogr_proj.o' failed
make: *** [ogr_proj.o] Error 1
ERROR: compilation failed for package ?rgdal?
* removing ?/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/rgdal?

The downloaded source packages are in
?/tmp/RtmpNkdFOf/downloaded_packages?
Warning message:
In install.packages("rgdal") :
  installation of package ?rgdal? had non-zero exit status
#
You might try this

install.packages("rgdal", "/sw/arcts/centos7/Rgeospatial/062020",
repos="http://R-Forge.R-project.org")

as there have been recent patches to rgdal that might help that have
been incorporated there.
On Thu, Jul 2, 2020 at 1:47 PM Thomas Adams <tea3rd at gmail.com> wrote:
#
Hi Bennet!

Thank you for your help, but I get the same error...

Tom
On Thu, Jul 2, 2020 at 2:01 PM Bennet Fauber <bennet at umich.edu> wrote:

            

  
    
#
On Thu, 2 Jul 2020, Thomas Adams wrote:

            
Tom,

Once rgdal revision 1029 completes building (check first) on:

https://r-forge.r-project.org/R/?group_id=884

please re-try. The missing function is not in the GDAL 3.0.0 headers, but 
is in the 3.0.1 headers. I've modified the check so as not to try for just
Roger

  
    
#
Roger,

Thank you so much; after downloading the *.tar.gz file, the that did the
trick, using:

sudo R CMD INSTALL --configure-args=--with-proj_api="proj_api.h"
rgdal_1.5-13.tar.gz

Best regards!
Tom
On Thu, Jul 2, 2020 at 3:15 PM Roger Bivand <Roger.Bivand at nhh.no> wrote:

            

  
    
#
On Thu, 2 Jul 2020, Thomas Adams wrote:

            
Since you have GDAL: 3.0.0 and PROJ version: 6.1.0, you can drop 
--configure-args=--with-proj_api="proj_api.h", which is only needed if 
GDAL < 3 and PROJ >= 6. I'm uncertain how stable a system will be if GDAL
work-around for systems with GDAL < 3 and PROJ >= 6, and onnly tested in 
that setting.

Thanks for reporting back!

Roger

  
    
#
Thank you, Roger! I'll re-install without using
--configure-args=--with-proj_api="proj_api.h

Best,
Tom
On Fri, Jul 3, 2020 at 5:45 AM Roger Bivand <Roger.Bivand at nhh.no> wrote:

            

  
    
#
Hi Roger,

I just tried re-installing withou using the argument and got this:

teaiii at teaiii-Leopard-WS:~$ sudo R CMD INSTALL rgdal_1.5-13.tar.gz
* installing to library ?/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0?
* installing *source* package ?rgdal? ...
** using staged installation
configure: R_HOME: /usr/local/lib/R
configure: CC: gcc
configure: CXX: g++ -std=gnu++11
configure: CFLAGS: -g -O2
configure: CPPFLAGS: -I/usr/local/include
configure: CXXFLAGS: -g -O2
configure: LDFLAGS: -L/usr/local/lib
configure: LDFLAGS: -L/usr/local/lib
configure: CXX11 is: g++, CXX11STD is: -std=gnu++11
configure: CXX is: g++ -std=gnu++11
configure: C++11 support available
configure: rgdal: 1.5-13
checking for /usr/bin/svnversion... yes
cat: inst/SVN_VERSION: No such file or directory
configure: svn revision:
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 3.0.0
checking GDAL version >= 1.11.4... yes
checking GDAL version <= 2.5 or >= 3.0... yes
checking GDAL: linking with --libs only... yes
checking GDAL: gdal-config data directory readable... yes
checking GDAL: /usr/local/share/gdal/stateplane.csv readable... yes
configure: pkg-config proj exists, will use it
configure: PROJ version: 6.1.0
configure: PROJ CPP flags: -DPROJ_H_API -I/usr/local/include
configure: PROJ LIBS: -L/usr/local/lib -lproj
checking PROJ header API:... yes
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -std=gnu++11 accepts -g... yes
checking how to run the C++ preprocessor... g++ -std=gnu++11 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking proj.h usability... yes
checking proj.h presence... yes
checking for proj.h... yes
checking for proj_context_create in -lproj... yes
checking Using GDAL < 3 with PROJ >= 6... no
checking PROJ version >= 4.8.0... yes
checking PROJ: proj.db found and readable... yes
configure: Package CPP flags:  -I/usr/local/include -I/usr/local/include
-DPROJ_H_API
configure: Package LIBS:  -L/usr/local/lib -lgdal -L/usr/local/lib -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c OGR_write.cpp -o OGR_write.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c gdal-bindings.cpp -o
gdal-bindings.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c init.c -o init.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c inverser.c -o inverser.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c local_stubs.c -o local_stubs.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogr_geom.cpp -o ogr_geom.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogr_polygons.c -o ogr_polygons.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogr_proj.cpp -o ogr_proj.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogrdrivers.cpp -o ogrdrivers.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c ogrsource.cpp -o ogrsource.o
g++ -std=gnu++11 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include
-I/usr/local/include -DPROJ_H_API
-I'/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/sp/include'
-I/usr/local/include   -fpic  -g -O2  -c proj6.cpp -o proj6.o
proj6.cpp: In function ?SEXPREC* transform_ng(SEXP, SEXP, SEXP, SEXP, SEXP,
SEXP, SEXP)?:
proj6.cpp:521:29: error: ?proj_create_crs_to_crs_from_pj? was not declared
in this scope
         if ((pj_transform = proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX,
source_crs,
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
proj6.cpp:521:29: note: suggested alternative: ?proj_create_crs_to_crs?
         if ((pj_transform = proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX,
source_crs,
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                             proj_create_crs_to_crs
proj6.cpp: In function ?SEXPREC* project_ng_coordOp(SEXP, SEXP)?:
proj6.cpp:704:33: error: ?proj_create_crs_to_crs_from_pj? was not declared
in this scope
     if (use_inv) pj_transform =
proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX, target_crs,
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
proj6.cpp:704:33: note: suggested alternative: ?proj_create_crs_to_crs?
     if (use_inv) pj_transform =
proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX, target_crs,
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                 proj_create_crs_to_crs
proj6.cpp:706:25: error: ?proj_create_crs_to_crs_from_pj? was not declared
in this scope
     else pj_transform = proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX,
source_crs,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
proj6.cpp:706:25: note: suggested alternative: ?proj_create_crs_to_crs?
     else pj_transform = proj_create_crs_to_crs_from_pj(PJ_DEFAULT_CTX,
source_crs,
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         proj_create_crs_to_crs
/usr/local/lib/R/etc/Makeconf:176: recipe for target 'proj6.o' failed
make: *** [proj6.o] Error 1
ERROR: compilation failed for package ?rgdal?
* removing ?/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/rgdal?
* restoring previous ?/home/teaiii/R/x86_64-pc-linux-gnu-library/4.0/rgdal?
On Fri, Jul 3, 2020 at 5:45 AM Roger Bivand <Roger.Bivand at nhh.no> wrote:

            

  
    
#
On Fri, 3 Jul 2020, Thomas Adams wrote:

            
Very useful, thanks - painful but another case of staying too close to the 
front. proj_create_crs_to_crs_from_pj() was new in PROJ 6.2.0. I'll try to 
adapt to accommodate older PROJ 6.

Roger

  
    
#
On Fri, 3 Jul 2020, Roger Bivand wrote:

            
Re-creating a GDAL 3.0.0 with PROJ 6.1.0 platform has thrown up another 
issue which which I'm struggling. I'll try to resolve it, but until then 
advice would be to update GDAL and PROJ to 3.0.4 and 6.3.1, which we know 
work (those are the versions in the CRAN Windows binary).

Roger

  
    
#
Roger,

OK; I'll update GDAL and PROJ to 3.0.4 and 6.3.1 and get back to you... you
anticipated my question... thank you!

Best,
Tom
On Fri, Jul 3, 2020 at 11:24 AM Roger Bivand <Roger.Bivand at nhh.no> wrote:

            

  
    
1 day later
#
Hi Roger!

I updated GDAL and PROJ to 3.0.4 and 6.3.1, respectively... the install
worked perfectly using:

sudo R CMD INSTALL rgdal_1.5-13.tar.gz

Thank you so much!

Best,
Tom
On Fri, Jul 3, 2020 at 11:24 AM Roger Bivand <Roger.Bivand at nhh.no> wrote:

            

  
    
#
The revisions needed to install on PROJ 6.1.0 and GDAL 3.0.0 involved a 
compiled function that only entered PROJ in 6.2.0, another that only 
entered GDAL in 3.0.1, and bugs in handling +proj=ob_tran in PROJ 6.0.0, 
6.1.0 and 6.1.1. Revision 1031 covering these and letting rgdal install on 
these (oldish) versions has been committed to R-Forge, and when the build 
completes will answer the intial question. The package installed using the 
old PROJ API because that choice also avoided the problem with GDAL, but 
didn't advance to being able to use WKT2 instead of Proj4 strings 
internally (with sp >= 1.4). In any case, GDAL 3.0.4 and PROJ 6.3.1 or 
later is a safer choice, but at least now those obliged to stay with 
earlier GDAL 3 and PROJ 6 should be covered.

Roger
On Sat, 4 Jul 2020, Thomas Adams wrote: