Skip to content

rgdal install fails (following GDAL building from source)

10 messages · Roger Bivand, Pierre Roudier

#
Dear all,

I'm using the (excellent) rgdal package for a while now, but following
the build from source of the last GDAL stable release, I can not
reinstall it.

When I'm asking for install.packages("rgdal"), I got the following error:

Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library '/usr/lib64/R/library/rgdal/libs/rgdal.so':
  libgdal.so.1: cannot open shared object file: No such file or directory
change in where GDAL has been installed, but I've been unsuccessful to
fix that so far.

Thanks for any hints.

Here is my config:

uname -a
Linux 2.6.33.6-147.fc13.x86_64 #1 SMP Tue Jul 6 22:32:17 UTC 2010
x86_64 x86_64 x86_64 GNU/Linux

Distro : Fedora 13 x86_64 (running KDE)

gdalinfo --version
GDAL 1.7.2, released 2010/04/23

The infamous libgdal.so file is located in /usr/local/lib/

sessionInfo()
R version 2.11.1 (2010-05-31)
x86_64-redhat-linux-gnu

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tcltk_2.11.1 tools_2.11.1

Cheers,

Pierre
#
On Mon, 19 Jul 2010, Pierre Roudier wrote:

            
Does gdalinfo --version run? Did you run ldconfig -v as su after 
installing GDAL? Check that GDAL itself can find its own shared objects, 
if it can, then so should rgdal.

Hope this helps,

Roger

  
    
#
Thanks for the reply Roger,
Yes, I ran su -c 'ldconfig -v' after the make install, and at the
moment gdalinfo --version gives me the good output (GDAL 1.7.2,
released 2010/04/23).
How could I do that? I had the same idea that if GDAL is running,
rgdal should be running as well, but I only checked using gdalinfo.

Moreover, if it could be of any help, here is the interesting bit
during the compilation of rgdal:

...
checking for pj_init_plus in -lproj... yes
./proj_conf_test: error while loading shared libraries: libgdal.so.1:
cannot open shared object file: No such file or directory
./proj_conf_test: error while loading shared libraries: libgdal.so.1:
cannot open shared object file: No such file or directory
Package CPP flags: -I/usr/local/include
Package LIBS: -L/usr/local/lib -lgdal
...

Thanks for the help,

Pierre
#
On Mon, 19 Jul 2010, Pierre Roudier wrote:

            
Is PROJ.4 installed correctly? There is no reason for it to depend on GDAL 
- my RHEL5 says:

$ ldd `which proj`
         libproj.so.0 => /usr/local/lib/libproj.so.0 (0x00002adcf57b0000)
         libm.so.6 => /lib64/libm.so.6 (0x000000308bc00000)
         libc.so.6 => /lib64/libc.so.6 (0x000000308b800000)
         /lib64/ld-linux-x86-64.so.2 (0x000000308b400000)

and

$ proj
Rel. 4.7.1, 23 September 2009
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]

with no dependency on GDAL. Do you maybe have a stale GRASS GDAL plugin 
hanging around?

Roger

  
    
#
Hi again,
It seems to be correctly installed:

xx$ ldd `which proj`
        linux-vdso.so.1 =>  (0x00007fff6ef08000)
        libproj.so.0 => /usr/lib64/libproj.so.0 (0x0000003e29000000)
        libm.so.6 => /lib64/libm.so.6 (0x0000003e26800000)
        libc.so.6 => /lib64/libc.so.6 (0x0000003e26400000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003e26000000)

xx$ proj
Rel. 4.7.1, 23 September 2009
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]
That is most likely indeed, as I tried (and failed) to build the GRASS
GDAL plugin from source!

What is the exact library that may mess this all up?

Thanks again,

Pierre
#
On Mon, 19 Jul 2010, Pierre Roudier wrote:

            
I think that there is a GDAL plugins directory somewhere in /usr/local - 
if it is there, it contains a reference to your previous GDAL install, 
probably called gdalplugins. Try removing it, or changing its name.

Roger

  
    
#
Yes, there was a gdalplugins folder in /usr/lib/, containing
ogr_GRASS.so. I removed the whole folder, but unfortunatley, the same
error is appearing on compilation of rgdal.

Thanks anyway,

Pierre
#
On Mon, 19 Jul 2010, Pierre Roudier wrote:

            
There must still be messes left around in various places. Does using 
locate, for example locate libgdal and locate gdalplugins help? Otherwise 
remove and reinstall PROJ.4 and GDAL. Most likely debris after experiments 
with the GRASS plugin (and maybe QGIS) are still around.

Roger

  
    
#
Here are the outputs of  locate libgdal and locate gdalplugins (as su):

# locate gdalplugins
(no files found, as I deleted the whole folder)

# locate libgdal
...some files in my home from the src package...
/usr/lib64/ogdi/libgdal.so
/usr/local/lib/libgdal.a
/usr/local/lib/libgdal.la
/usr/local/lib/libgdal.so
/usr/local/lib/libgdal.so.1
/usr/local/lib/libgdal.so.1.14.2

# ls -l /usr/local/lib/libgdal*
-rw-r--r--. 1 root root 65383080 Jul 19 17:42 /usr/local/lib/libgdal.a
-rwxr-xr-x. 1 root root     1038 Jul 19 17:42 /usr/local/lib/libgdal.la
lrwxrwxrwx. 1 root root       17 Jul 19 17:42
/usr/local/lib/libgdal.so -> libgdal.so.1.14.2
lrwxrwxrwx. 1 root root       17 Jul 19 17:42
/usr/local/lib/libgdal.so.1 -> libgdal.so.1.14.2
-rwxr-xr-x. 1 root root 29847891 Jul 19 17:42 /usr/local/lib/libgdal.so.1.14.2

The latter command is probably interesting - actually the libgdal.so.1
on my system is a symlink to /usr/local/lib/libgdal.so.1.14.2.
Unfortunately, I don't really understand the meaning of those
different libgdal*

I appreciate your valuable help Roger, and any hint on that is most
welcome. As the problem seems to relate more on GDAL than R, I'll
probably drop a line to the GDAL-dev mailing list.

Cheers,

Pierre
#
I finally got the problem: there was a mistake within my
/etc/ld.so.conf.d file that linked the libgdal library into the
system.

For the record, my mistake was to put the full path to the file plus
the filename:

$ cat /etc/ld.so.conf.d/gdal.conf
/usr/local/lib/libgdal.so.1

I resolved the problem simply by modifying /etc/ld.so.conf.d/gdal.conf
to /usr/local/lib, and ldconfig as su.

Pierre

2010/7/19 Roger Bivand <Roger.Bivand at nhh.no>: