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

Roger Bivand Roger.Bivand at nhh.no
Sat Jan 8 18:40:47 CET 2011


On Thu, 30 Dec 2010, Roger Bivand wrote:

> On Wed, 29 Dec 2010, Agustin Lobo wrote:
>
>> Roger,
>> 
>> But
>> http://www.kyngchaos.com/files/software/frameworks/rgdal-0.6.29-1.zip
>> installs with no problems on the same machine and on the same R, would that 
>> not
>> discard the possibility of an
>>> issue of your R installation,
>>> possibly a multi-architecture issue
>> 
>> as you suggest?
>> 
>> Please note I'm not personally in a hurry any more as we can work with
>> the rgdal from kyngchaos.
>
> I will have access to an OSX laptop in a little over a week, and will try out 
> the CRAN rgdal binaries. Just one report of installation failure isn't 
> enough. I think that maybe someone on R-sig-mac might know why rgdal.so is 
> looking for libR.dylib; I don't use OSX, and don't have easy access to such a 
> machine, which is why I asked for others to comment.

On a Leopard 10.5.8, I see the problem reported by Agus for the CRAN-extra 
OSX binary rgdal package and freshly installed R 2.12.1 (libR.dylib image 
not found) in the 32-bit R-GUI, but no problem when running R from the 
command line. A different problem (mach-o, but wrong architecture) occurs 
in 64-bit systems, both run from the command line and from R-GUI. Could 
anyone who wants to follow this up please post to R-sig-Mac, which is the 
correct list for OSX issues?

Conclusion: on Leopard, the CRAN extras rgdal binary can be used in the 
32-bit R application run from the command line, but not otherwise. R 
2.12.1 installs the 64-bit GUI into the OSX applications toolbar - one 
needs to open a terminal and type "R", checking that the length of a 
pointer is 4, to run the version that works.

Roger

PS. The symptoms are:

R64, R-GUI 64

> library(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/x86_64/rgdal.so':

dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/x86_64/rgdal.so, 
6): no suitable image found.  Did find:

/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/x86_64/rgdal.so: 
mach-o, but wrong architecture
Error: package/namespace load failed for 'rgdal'



R-GUI 32

> library(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
Error: package/namespace load failed for 'rgdal'


>
> Roger
>
>> I just want to report the error to help
>> having an rgdal installation for MACOSX as
>> simple as for Windows.
>> I understand installing from source will always be a bit more
>> difficult on MACOSX than on linux as there are some basic tools and
>> libraries that are missing on regular MAC systems that must be
>> previously installed, but this is not my concern now as I'm focusing
>> on installations from binaries.
>> 
>> Thanks!
>> 
>> Agus
>> 
>> 
>> 
>> 2010/12/29 Roger Bivand <Roger.Bivand at nhh.no>:
>>> 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
>>>> 
>>> '/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/i$
>>>> 
>>> dlopen(/Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal$
>>>> 
>>>> 6): Library not loaded: libR.dylib
>>>>  Referenced from:
>>>> 
>>> /Library/Frameworks/R.framework/Versions/2.12/Resources/library/rgdal/libs/i3$
>>>> 
>>>>  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:
>>> 
>>> http://r.research.att.com/tools/
>>> http://cran.r-project.org/bin/macosx/tools
>>> 
>>> 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 source.
>>> 
>>> 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.
>>> 
>>> Roger
>>> 
>>> 
>>>> (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
>>> 
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> 
>> 
>
>

-- 
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