Errors installing from source - MAC OS M1 and R 4.1/Rstudio daily build

I am occasionally running into some difficulties installing from source. This my setup, in addition to Rstudio Version 1.4.1674

R Under development (unstable) (2021-04-08 r80148)
Platform: aarch64-apple-darwin20.0 (64-bit)
Running under: macOS Big Sur 11.2.3

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

Here is what I get when I try to install package lubridate (though I run into similar problems with some - not all - pacakges):

installing the source package ‘lubridate’

trying URL 'https://cran.rstudio.com/src/contrib/lubridate_1.7.10.tar.gz'
Content type 'application/x-gzip' length 473547 bytes (462 KB)
==================================================
downloaded 462 KB

* installing *source* package ‘lubridate’ ...
** package ‘lubridate’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I./cctz/src/ -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cctz/src/time_zone_fixed.cc -o cctz/src/time_zone_fixed.o
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I./cctz/src/ -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cctz/src/time_zone_if.cc -o cctz/src/time_zone_if.o
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I./cctz/src/ -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cctz/src/time_zone_impl.cc -o cctz/src/time_zone_impl.o
In file included from cctz/src/time_zone_impl.cc:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/unordered_map:409:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__hash_table:18:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isfinite' in the global namespace
using ::isfinite;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:323:7: error: no member named 'isgreater' in the global namespace; did you mean '::std::greater'?
using ::isgreater;
      ^~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:738:29: note: '::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
                            ^
In file included from cctz/src/time_zone_impl.cc:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/unordered_map:409:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__hash_table:18:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:324:7: error: no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
using ::isgreaterequal;
      ^~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:767:29: note: '::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from cctz/src/time_zone_impl.cc:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/unordered_map:409:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__hash_table:18:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:327:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:328:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:329:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
13 errors generated.
make: *** [cctz/src/time_zone_impl.o] Error 1
ERROR: compilation failed for package ‘lubridate’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lubridate’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lubridate’
Warning in install.packages :
  installation of package ‘lubridate’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/jr/19fz7v9976gbf62sf66f7zz40000gq/T/RtmpNeEkUk/downloaded_packages’
> start <- Sys.time()
> summary_stats <- rbindlist(lapply(scenarios, function(a) s_replicate(a, nsim = 2000)))
> Sys.time() - start
Time difference of 9.373234 mins
> s_replicate <- function(argsvec, nsim) {
+   
+   list_of_defs <- s_define()
+   
+   model_results <- rbindlist(
+     parallel::mclapply(
+       X = 1 : nsim, 
+       FUN = function(x) s_single_rep(list_of_defs, argsvec), 
+       mc.cores = 8)
+   )
+   
+   #--- summary statistics ---#
+   
+   power <- model_results[, mean(pval <= 0.05)]
+   summary_stats <- data.table(t(argsvec), power)
+   
+   return(summary_stats) # summary_stats is a data.table
+ }
> start <- Sys.time()
> summary_stats <- rbindlist(lapply(scenarios, function(a) s_replicate(a, nsim = 2000)))
> Sys.time() - start
Time difference of 4.344438 mins
> parallel::detectCores()
[1] 8
> install.packages("lubridate")

  There is a binary version available but the source version is later:
           binary source needs_compilation
lubridate 1.7.9.2 1.7.10              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘lubridate’

trying URL 'https://cran.rstudio.com/src/contrib/lubridate_1.7.10.tar.gz'
Content type 'application/x-gzip' length 473547 bytes (462 KB)
==================================================
downloaded 462 KB

* installing *source* package ‘lubridate’ ...
** package ‘lubridate’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I./cctz/src/ -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/homebrew/Cellar/gettext/0.21/include -I/opt/homebrew/opt/llvm/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cctz/src/time_zone_fixed.cc -o cctz/src/time_zone_fixed.o
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I./cctz/src/ -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/homebrew/Cellar/gettext/0.21/include -I/opt/homebrew/opt/llvm/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cctz/src/time_zone_if.cc -o cctz/src/time_zone_if.o
clang++ -arch arm64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I. -I./cctz/src/ -I'/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Rcpp/include' -I/opt/homebrew/Cellar/gettext/0.21/include -I/opt/homebrew/opt/llvm/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c cctz/src/time_zone_impl.cc -o cctz/src/time_zone_impl.o
In file included from cctz/src/time_zone_impl.cc:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/unordered_map:409:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__hash_table:18:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'signbit' in the global namespace
using ::signbit;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isfinite' in the global namespace
using ::isfinite;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isinf' in the global namespace
using ::isinf;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isnan' in the global namespace
using ::isnan;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:323:7: error: no member named 'isgreater' in the global namespace; did you mean '::std::greater'?
using ::isgreater;
      ^~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:738:29: note: '::std::greater' declared here
struct _LIBCPP_TEMPLATE_VIS greater : binary_function<_Tp, _Tp, bool>
                            ^
In file included from cctz/src/time_zone_impl.cc:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/unordered_map:409:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__hash_table:18:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:324:7: error: no member named 'isgreaterequal' in the global namespace; did you mean '::std::greater_equal'?
using ::isgreaterequal;
      ^~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:767:29: note: '::std::greater_equal' declared here
struct _LIBCPP_TEMPLATE_VIS greater_equal : binary_function<_Tp, _Tp, bool>
                            ^
In file included from cctz/src/time_zone_impl.cc:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/unordered_map:409:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__hash_table:18:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isless' in the global namespace
using ::isless;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:327:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:328:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/cmath:329:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
      ~~^
13 errors generated.
make: *** [cctz/src/time_zone_impl.o] Error 1
ERROR: compilation failed for package ‘lubridate’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lubridate’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/lubridate’
Warning in install.packages :
  installation of package ‘lubridate’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/jr/19fz7v9976gbf62sf66f7zz40000gq/T/RtmpNeEkUk/downloaded_packages’

Any ideas?

Installing to macOS from source has always been, and is likely always to be, problematic because Apple uses a non-standard compiler. If it doesn't work the first time, it won't work unless the user edits the source code. It is always better to install the binary version.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.