I recently upgraded R. I started having problems loading any library (I tried with the "oce" packages, "testthat", "gsw". I also tried to load other libraries, for instance
library(raster)
library(sp)
library(rgdal)
I always get the same message (for all the different libraries I am trying to load!):
library('testthat')
Error: package or namespace load failed for ‘testthat’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/testthat/libs/testthat.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/testthat/libs/testthat.so, 6): Symbol not found: ___cxa_uncaught_exceptions
Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
Expected in: /usr/lib/libc++abi.dylib
in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libc++.1.dylib
I checked in the specified folder and these libraries are in the right place! I uninstalled (from my terminal, also uninstalling the R.Framework folder and checking it was uninstalled), and re-installed R at least 2 times. Still the same problem!
I was able to load "oce" a few months ago.
Please let me know if you can help me fix this issue!
In the macOS environment, this may be due to how R was installed. With R 3.6.3, there is now a notarized pkg file as well as what may well be the last of the unsandboxed versions. I'm using the notarized version and just removed and re-installed oce without issue.
This seems consistent with the error messages that the linker failed and if you are also under Catalina would seem to be strong evidence.
Here's my sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.3
If your's is consistent, my suggestion is to re-install R directly from the CRAN site, taking special care to select the notarized` version.
Also, when you update your R version, you have to update your packages with checkBuilt=TRUE option, to check for packages that require compilation under the same R version.