Removing the old R Custom gfortran 4.8.2 Binary

Editor’s Note: Previous version of this advice could be found in the R Compiler Tools for Rcpp on macOS.

Intro

The goal behind this post is to remove an outdated installation of R’s custom gfortran 4.8.2 binary. For many, this post is not relevant unless their computer required an R version between 3.0.0 - R 3.3.3 or are only now just upgrading R.

Motivation

When working with fortran-based routines, there is an issue that may arise with respect to unable to load shared object.

The common question that arises is: Why doesn’t the shared object load?

If you are receiving the error message of Symbol not found: ___addtf3, then there is an old installation of R’s custom gfortran binary sitting in /usr/local.

The full error message is given as:

Error: 
 package or namespace load failed for ‘RcppArmadillo’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object
 '/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppArmadillo/libs/RcppArmadillo.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/Resources/library/RcppArmadillo/libs/RcppArmadillo.so, 6):
Symbol not found: ___addtf3
Referenced from: /usr/local/lib/libquadmath.0.dylib
Expected in: /usr/local/lib/libgcc_s_x86_64.1.dylib
in /usr/local/lib/libquadmath.0.dylib

Removing Old Installation Files

In short, we need to remove the CRAN-built gfortran-4.8.2 binary that was in use from R 3.0.0 - R 3.3.3. To do so, we’ll download the binary and iterate through each file to remove them. Please run in Terminal the following shell script.

# Download installer into working directory
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2

# Remove _files_ associated with the binary
for file in $(tar tfz gfortran-4.8.2-darwin13.tar.bz2); do
sudo rm -f /$file; 
done

# Remove empty _folders_ associated with the binary
for folder in $(tar tfz gfortran-4.8.2-darwin13.tar.bz2); do 
sudo rmdir -p /$folder; 
done

# Delete the installer
rm -rf gfortran-4.8.2-darwin13.tar.bz2

From there, please install the appropriate gfortran binary described in R Compiler Tools for Rcpp on macOS.

comments powered by Disqus