[R-sig-Geo] Installation of rgdal from CRAN on MACOSX does not work

Roger Bivand Roger.Bivand at nhh.no
Wed Dec 29 16:02:01 CET 2010

On Wed, 29 Dec 2010, Agustin Lobo wrote:

> While the installation from
> http://www.kyngchaos.com/files/software/frameworks/rgdal-0.6.29-1.zip
> works fine
> the installation of rgdal from CRAN on MACOSX does not work, despite
> my previous message that this issue was solved as well

Please do read the error message:

>  unable to load shared object
> 6): Library not loaded: libR.dylib
>  Referenced from:
>  Reason: image not found

The image that is not found is libR.dylib, the main R dylib against which 
rgdal.so is linked. So this is still an issue of your R installation, 
possibly a multi-architecture issue (is libR.dylib the i386 version, 
guessing - is libR64.dylib the 64-bit Intel version?).

Could any OSX users who are using CRAN extra rgdal please help Agus to 
resolve this - it could be that local path modifications are hiding 
libR.dylib, or that R was installed 64-bit only, and the INSTALL_opts= 
argument to install.packages() was not set correctly? I assume that the 
CRAN extras OSX rgdal binary is built against a standard R OSX Intel 
install, which is multi-architecture.

For a fully updated rgdal, the best combination remains installing the 
full GDAL framework from Kyngchaos, the full tools collection:


and install from CRAN source. For a lab, the instructor would rather build 
a local OSX rgdal binary package using the tools collection on one 
development machine with all the correct path variables set (R CMD check 
rgdal; R CMD INSTALL --build rgdal), paying attention to 
multi-architectures, and distribute to lab machines from there. This means 
that the lab instructor can keep rgdal updated if need be, as both 
Kyngchaos and CRAN extras rgdal OSX binary packages typically lag CRAN 

Please also note that there are very many very old GDAL binaries out there 
that users pick up and apply, missing all the subsequent bug-fixes and 
improvements - GDAL 1.8.0 release candidate 1 is now out, so we are 
looking at an upgrade to 1.8.0 during January, which Kyngchaos will most 
likely pick up quickly, probably with a current rgdal binary.


> (my confusion was a consequence of mixing both installations in the
> same session):
>> setRepositories(ind=1:2)
>> install.packages("rgdal")
> --- Please select a CRAN mirror for use in this session ---
> probando la URL
> 'http://www.stats.ox.ac.uk/pub/RWin/bin/macosx/leopard/contrib/2.12/rgdal_0.6-31.tgz'
> Content type 'application/x-gzip' length 10203689 bytes (9.7 Mb)
> URL abierta
> ==================================================
> downloaded 9.7 Mb
> The downloaded packages are in
> 	/var/folders/iR/iRxOvaG9F10viNoa7WceNU+++TI/-Tmp-//RtmpqIhqn9/downloaded_packages
>> require(rgdal)
> Loading required package: rgdal
> Loading required package: sp
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
>  unable to load shared object
> '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/i386/rgdal.so':
>  dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/i386/rgdal.so,
> 6): Library not loaded: libR.dylib
>  Referenced from:
> /Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/i386/rgdal.so
>  Reason: image not found
>> sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: i386-apple-darwin9.8.0/i386 (32-bit)
> locale:
> [1] es_ES.UTF-8/es_ES.UTF-8/C/C/es_ES.UTF-8/es_ES.UTF-8
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
> other attached packages:
> [1] sp_0.9-76
> loaded via a namespace (and not attached):
> [1] grid_2.12.1     lattice_0.19-13 tools_2.12.1
> Note that rgdal.so is where it should be:
> imac-de-agustin-lobo:~ agustinlobo$ ls -l
> /Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/i386/
> total 15088
> -rwxr-xr-x  1 agustinlobo  admin  7722168  4 dic 15:57 rgdal.so
> This error is not solved by setting the GDAL path.
> Agus

Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list