[R-SIG-Mac] Update to versions GEOS 3.8.0, GDAL 3.0.4 and PROJ 7.0.0 in macOS Catalina

Alberto Lázaro-López @|@z@ro|op @end|ng |rom po@teo@me
Tue Jun 16 00:46:06 CEST 2020


Good day Manuel,

There is a very comprehensive guide on how to build R with full capabilities and with OpenBLAS and OpenMP support in macOS Mojave (10.14) that also considers necessary software to build spatial packages [1]. There are some small details to be adjusted for macOS Catalina though, so I’m writing them below. 


1. Under Xcode section, you just need to run `xcode-select --install` and complete the GUI installation of Developers Tools. Catalina completely changes this process, making unnecessary to run another .pkg as indicated. 

2. Instead of Homebrew-core versions, you should install `osgeo-proj` and `osgeo-gdal`. Check they and gcc are linked with the command `brew link <formula>`.

3. After that, you can add this line to the ~/.Renviron file

> PATH="/usr/local/opt/llvm/bin:${PATH}:/usr/local/opt/osgeo-gdal/bin”

4. According to another post [2], a small fix should be made in ~/.R/Makervars .  Be aware of comments as Xcode path and cores should be adjusted to your conditions. 

> LDFLAGS+=-L$(HO)/llvm/lib -Wl,-rpath,$(HO)/llvm/lib -mlinker-version=305

5. Following the instructions, you should be able to build packages without issues, like “rgdal” or “sf”. For example, for “sf"

> library(sf)
Linking to GEOS 3.8.1, GDAL 3.1.0, PROJ 6.3.2

I guess you could skip points 4 and 5 in "Homebrew packages" and try to use your current R installation, but it depends on your config.


Overall, it’s more challenging than the standard installation and you’ll need to take care of more components, but you also get more control and capabilities in R. I hope you find it useful and get fixed your issue.
Best regards,


[1]: https://www.btskinner.io/code/install-r-with-openblas-and-openmp-on-macos-mojave/

[2]: https://stackoverflow.com/questions/61103104/ld-unknown-option-platform-version-when-building-r-packages-from-source


Alberto Lázaro-López
about.me/alazarolop

> On 10 Jun 2020, at 12:53, Alberto Lázaro-López <alazarolop using posteo.me> wrote:
> 
> Good day Manuel,
> 
> I understand there are several conditions impacting in your issue. 
> 
> 1. Since you are building packages from source, you need to get some toolsets working together correctly: macOS Developer Tools, gcc, Fortran and LLVM. 
> 
> 2. You are also using an R version installed from .pkg installer, and I’m not sure whether it’s also behind the problem.  
> 
> I can tell I have the .dylib file you mentioned in that directory and it’s not a symlink, so I’m not sure about its origin. On the other hand, I’ve never faced a similar issue. I use a compiled version of R from a Homebrew tap [1] with the toolsets listed above set up (including some PATH adjustment and a Makevars file). 
> 
> I’ll write a tutorial on how I got it working and share it to the list, so anyone can try to reproduce it. I would suggest you to follow it in an independent SO installation, so you don’t risk your production environment. 
> 
> [1]: https://github.com/sethrfore/homebrew-r-srf
> 
> Best regards,
> 
> Alberto D. Lázaro López
> about.me/alazarolop
> 
>> On 8 Jun 2020, at 16:06, Manuel Spínola <mspinola10 using gmail.com> wrote:
>> 
>> Thank you very much Alberto,
>> 
>> I tried:
>> 
>> brew tap osgeo/osgeo4mac
>> brew unlink gdal
>> brew unlink proj
>> 
>> brew install osgeo-gdal
>> brew install osgeo-proj
>> brew link osgeo-gdal
>> brew link osgeo-proj
>> 
>> install.packages("rgdal", type = "source")
>> 
>> Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
>> unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-rgdal/00new/rgdal/libs/rgdal.so':
>>  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-rgdal/00new/rgdal/libs/rgdal.so, 6): Symbol not found: ___addtf3
>>  Referenced from: /usr/local/opt/gcc/lib/gcc/9/libquadmath.0.dylib
>>  Expected in: /usr/lib/libSystem.B.dylib
>> in /usr/local/opt/gcc/lib/gcc/9/libquadmath.0.dylib
>> Error: loading failed
>> Execution halted
>> 
>> After trying to find a solution, some people suggested me to wait for the binary packages.
>> 
>> Manuel
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> El dom., 7 jun. 2020 a las 4:47, Alberto Lázaro-López (<alazarolop using posteo.me>) escribió:
>> Hi all, 
>> 
>> I got in touch with Manuel Spínola in R-sig-geo mailing list, I didn’t keep an eye on this list though. 
>> I’ve seen some mails regarding issues with PROJ and GDAL in macOS following Homebrew versions.
>> 
>> We are maintaining a Homebrew tap focused on OSGeo projects called OSGeo4Mac.
>> At this moment, it’s serving bottles for GDAL 3.1.0 and PROJ 6.3.2, but also other GIS software as PostGIS or SAGA.
>> They are intended to be more flexible and provide more functionality than those available as core versions too.
>> 
>> We are also looking for collaborators to discuss and support formulas they are interested in. 
>> You are really welcome.
>> 
>> Best regards,
>> 
>> Alberto D. Lázaro López
>> about.me/alazarolop <https://bit.ly/ALazaroLop>
>> 
>>        [[alternative HTML version deleted]]
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac using r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>> 
>> 
>> -- 
>> Manuel Spínola, Ph.D. 
>> Instituto Internacional en Conservación y Manejo de Vida Silvestre 
>> Universidad Nacional 
>> Apartado 1350-3000 
>> Heredia 
>> COSTA RICA 
>> mspinola using una.cr 
>> mspinola10 using gmail.com 
>> Teléfono: (506) 8706 - 4662
>> Personal website: Lobito de río 
>> Institutional website: ICOMVIS
> 



More information about the R-SIG-Mac mailing list