Unable to load most packages (issue with libc++.1.dylib)

Good afternoon,

I have been using R for a few days, within R studio, with no evident issues. The operating system is Mac OS 10.11 (El Capitan), R version 3.6.

Recently I tried to install the package swirl, and after failing to be loaded (it did download, but could not be added with the command library) I know cannot load most packages including all those in the tidyverse.
Depending on the package I try to load I get different error message, but all point (as far as I can understand) to an issue with libc++.1.dylib.

Some examples:


> library("tidyverse", lib.loc="/Library/Frameworks/R.framework/Versions/3.6/Resources/library")

Error: package or namespace load failed for ‘tidyverse’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.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


> library("ggplot2", lib.loc="/Library/Frameworks/R.framework/Versions/3.6/Resources/library")

Error: package or namespace load failed for ‘ggplot2’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/Rcpp/libs/Rcpp.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

> library("rmarkdown", lib.loc="/Library/Frameworks/R.framework/Versions/3.6/Resources/library")

Error: package or namespace load failed for ‘rmarkdown’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/digest/libs/digest.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/digest/libs/digest.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

After reading similar questions on various fora, I tried to reinstall the packages Rcpp and digest; the problem persisted.
I uninstalled completely R and installed it again, but still the behavior is identical.

CORRECTION:
The file libc++.1.dylib as well as libc++abi.dylib are indeed located in /usr/lib/

The file libc++.1.dylib in /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/

...although I am pretty sure I do not completely understand what the error message I get is lamenting exactly.

What I am pretty sure about, is that my question is a basic one and it betrays my scarce understanding of the library mechanics of R, for which I apologize.

Thanks so much for your help.

MacOS is squirrelly when it comes to compiling and linking, and there's no guarantee that something which worked in El Capitan will necessarily work in Mojave. Apple keeps fiddling with its compiler and libraries, which is why you have to update XCode, as well.

On mine

  1. Upgrade after a month to see if it breaks things for others.
  2. Upgrade XCode and XCode command line tools

But in this case, the upgrade to R 3.6.0 seems to be responsible for the grief. Lots of packages had to be updated or re-installed.

What I'd try first is

install.packages("tidyverse")

That will bring in a ton of dependencies including recompiled versions of the ones giving you trouble, and that may clear the air for Rcpp and digest as well.

Report back and we'll see what else to try if this fails.

First of all, thanks a lot for taking the time to help me.

reinstalling the tidyverse did not fix the issue, nor did uninstalling it and reinstalling it. Ultimately, I downloaded version 3.5.3 of R for El Capitan and as far as I can tell it is now working.

In case this is helpful for other (inexperienced) users, my issues did not follow an update of the operating system or R version: I only ever had 3.6 installed. They started after I tried to install the package "swirl". Maybe they assume nobody is still on an operating system as old as El Capitan?

Thanks again for helping a total noob. Very much appreciated.

Great! Way to go. I'm glad you figured it out. This is a forum with a lot of helpful people and a minimum of attitude. Most of us recognize that when it comes to R and its scaffolding, not to mention the mysteries of applied statistics that we are all noobs about a lot of stuff, and there's no shame to owning up to it. And there's no shame, either, at least for me, hearing "no you're wrong for the following reasons." So please come back as questions arise. Yours today didn't need one but take a look at reproducible example, called a reprex for one way to get better answers when you're stuck.

Happy EDA!

1 Like

EVERYBODY had some problems with R 3.6.0, OS, Win, Linux. It happens, and it usually works out. Don't be hard on yourself. We're all test pilots here, and sometimes we are going to have to bail and watch the vehicle crash and burn. Sometimes multiple disasters. Over time, you come to recognize the usual suspects and how to fix them. This one was unusual and I predict we won't see it for another 5 years, at least. (Based solely on wishful thinking at an advanced age.) One suggestion when working a problem like this is to keep a log to remind yourself that what you are about to try has already failed.

I'm proud of you for figuring out that downversioning was the solution to your immediate problem. That's a decided step up from noob.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.