1

After updating to macOS Big Sur 11.4 and installing the latest versions of R (4.1.0), RStudio (1.4.1717) and Xcode (12.5.1) (for Command Line Tools), I am unable to build and install my R package from source (which relies on complied C++ code) via devtools::build() and devtools::install().

Every time I do this in RStudio, I receive the error message:

Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

When I call the above, I am prompted to select "Yes" to install the build tools. However, when I nothing happens.

I have checked to ensure Xcode CLT is installed, and sure enough, it is:

$  xcode-select -p
/Applications/Xcode.app/Contents/Developer

My package relies on both Rcpp and RcppArmadillo. I have installed these within RStudio. devtools is also installed.

I cannot even install my package directly from GitHub via devtools::install_github()

Any ideas on what could be going on here and how I can resolve the issue?

I followed the steps in this post:

clang-7: error: linker command failed with exit code 1 for macOS Big Sur

including altering the Makevars as per the above post.

If it helps, here is my old Makevars

## With R 3.1.0 or later, you can uncomment the following line    to tell R to 
## enable compilation with C++11 (where available)
##
## Also, OpenMP support in Armadillo prefers C++11 support.   However, for wider
## availability of the package we do not yet enforce this here.  It is however
## recommended for client packages to set it.
##
## And with R 3.4.0, and RcppArmadillo 0.7.960.*, we turn C++11 on as OpenMP
## support within Armadillo prefers / requires it
CXX_STD = CXX11

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) 
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS)   $(FLIBS)

Thanks!

compbiostats
  • 909
  • 7
  • 22
  • Did you restart R after running `xcode-select -p`? What is the output you see when you run `pkgbuild::check_build_tools(debug = TRUE)`? – MrFlick Jul 04 '21 at 07:20
  • Do you have Rtools installed? – Aaron Gorman Jul 04 '21 at 10:40
  • Yes, R was restarted. When I run `pkgbuild::check_build_tools(debug = TRUE)` A "Install build tools" window appears indicating "Building R package from source requires installation of additional build tools. Do you want to install the additional tools now?" When I click "Yes", the error message I indicated in my post appears. – compbiostats Jul 04 '21 at 16:36
  • @AaronGorman I am a mac user. Rtools is for Windows. Xcode replaces the Rtools on my OS. – compbiostats Jul 04 '21 at 16:40
  • I have added my Makevars file should this make things clearer. – compbiostats Jul 05 '21 at 04:37

0 Answers0