Error compiling source packages

I'm having issues compiling certain packages from source. I'm getting different errors in several cases I've found. Here they are in short, with the full printout at the end of this post:

#1

** testing if installed package can be loaded from temporary location
sh: line 1: 69462 Segmentation fault: 11  R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T//Rtmp3WutjJ/file10e7f1b64a0fb'

 *** caught segfault ***
address 0x30, cause 'memory not mapped'

#2

** testing if installed package can be loaded from temporary location
sh: line 1: 69665 Abort trap: 6           R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T//Rtmp93p6kU/file10fc52393e443'
ERROR: loading failed

#3

 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs

(some code removed)

Error: package or namespace load failed for ‘RcppArmadillo’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so, 6): Symbol not found: __ZNKSt13random_device13_M_getentropyEv
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so
Error: loading failed

I have tried the following so far in roughly this order:

I am running OSX 10.15.5, R 4.0.2

Here are the full details of each failed compile:

> devtools::install_github("tylermorganwall/rayshader")
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo tylermorganwall/rayshader@master

✓  checking for file ‘/private/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T/Rtmpm4EPFO/remotes10f732e6edc2b/tylermorganwall-rayshader-a9e5898/DESCRIPTION’ ...
─  preparing ‘rayshader’:
✓  checking DESCRIPTION meta-information ...
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Removed empty directory ‘rayshader/tools’
─  building ‘rayshader_0.19.1.tar.gz’
   
* installing *source* package ‘rayshader’ ...
** using staged installation
** libs
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c bilineargrid.cpp -o bilineargrid.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c calculate_normal.cpp -o calculate_normal.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c construct_matrix.cpp -o construct_matrix.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c find_groups.cpp -o find_groups.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c interpolate_color.cpp -o interpolate_color.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c lambshade.cpp -o lambshade.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c make_base_cpp.cpp -o make_base_cpp.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c pointspread.cpp -o pointspread.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c rayshade.cpp -o rayshade.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/progress/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c rayshade_multicore.cpp -o rayshade_multicore.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/Cellar/gcc@8/8.4.0_1/lib -o rayshader.so RcppExports.o bilineargrid.o calculate_normal.o construct_matrix.o find_groups.o interpolate_color.o lambshade.o make_base_cpp.o pointspread.o rayshade.o rayshade_multicore.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-rayshader/00new/rayshader/libs
** R
** data
*** moving datasets to lazyload DB
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
sh: line 1: 69665 Abort trap: 6           R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T//Rtmp93p6kU/file10fc52393e443'
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/rayshader’
Error: Failed to install 'rayshader' from GitHub:
  (converted from warning) installation of package ‘/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T//Rtmpm4EPFO/file10f73164c94ba/rayshader_0.19.1.tar.gz’ had non-zero exit status



> install.packages("RcppArmadillo")

  There is a binary version available but the source version is later:
                   binary      source needs_compilation
RcppArmadillo 0.9.900.1.0 0.9.900.2.0              TRUE

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

trying URL 'https://cran.rstudio.com/src/contrib/RcppArmadillo_0.9.900.2.0.tar.gz'
Content type 'application/x-gzip' length 1645254 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘RcppArmadillo’ ...
** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 accepts -g... yes
checking how to run the C++ preprocessor... /usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether /usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 accepts -g... (cached) yes
checking whether we have a suitable tempdir... /var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T
checking whether R CMD SHLIB can already compile programs using OpenMP... yes
checking LAPACK_LIBS... R-supplied partial LAPACK found
configure: WARNING: Some complex-valued LAPACK functions may not be available
configure: creating ./config.status
config.status: creating inst/include/RcppArmadilloConfigGenerated.h
config.status: creating src/Makevars
** libs
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include  -I../inst/include  -fPIC  -Wall -g -O2  -c RcppArmadillo.cpp -o RcppArmadillo.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include  -I../inst/include  -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include  -I../inst/include  -fPIC  -Wall -g -O2  -c fastLm.cpp -o fastLm.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/Cellar/gcc@8/8.4.0_1/lib -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RcppArmadillo’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so, 6): Symbol not found: __ZNKSt13random_device13_M_getentropyEv
  Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-RcppArmadillo/00new/RcppArmadillo/libs/RcppArmadillo.so
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo’
Warning in install.packages :
  installation of package ‘RcppArmadillo’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T/Rtmpm4EPFO/downloaded_packages’

> install.packages("raster")

  There is a binary version available but the source version is later:
       binary source needs_compilation
raster  3.3-7 3.3-13              TRUE

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

trying URL 'https://cran.rstudio.com/src/contrib/raster_3.3-13.tar.gz'
Content type 'application/x-gzip' length 574517 bytes (561 KB)
==================================================
downloaded 561 KB

* installing *source* package ‘raster’ ...
** package ‘raster’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RasterModule.cpp -o RasterModule.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c aggregate.cpp -o aggregate.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c area.cpp -o area.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c bilinear.cpp -o bilinear.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c broom.cpp -o broom.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c cellRowCol.cpp -o cellRowCol.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c clamp.cpp -o clamp.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c distance.cpp -o distance.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c edge.cpp -o edge.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c focal_fun.cpp -o focal_fun.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c focal_get.cpp -o focal_get.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c focal_sum.cpp -o focal_sum.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/gcc-8 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c geodesic.c -o geodesic.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c getPolygons.cpp -o getPolygons.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c layerize.cpp -o layerize.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c memory.cpp -o memory.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c modal.cpp -o modal.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c ppmin.cpp -o ppmin.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c raster_aggregate.cpp -o raster_aggregate.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c raster_distance.cpp -o raster_distance.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c rasterize.cpp -o rasterize.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c reclass.cpp -o reclass.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c terrain.cpp -o terrain.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c util.cpp -o util.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c xyCell.cpp -o xyCell.o
/usr/local/Cellar/gcc@8/8.4.0_1/bin/g++-8 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/Cellar/gcc@8/8.4.0_1/lib -o raster.so RasterModule.o RcppExports.o aggregate.o area.o bilinear.o broom.o cellRowCol.o clamp.o distance.o edge.o focal_fun.o focal_get.o focal_sum.o geodesic.o getPolygons.o layerize.o memory.o modal.o ppmin.o raster_aggregate.o raster_distance.o rasterize.o reclass.o terrain.o util.o xyCell.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-raster/00new/raster/libs
** R
** inst
** byte-compile and prepare package for lazy loading
in method for ‘brick’ with signature ‘x="kasc"’: no definition for class “kasc”
in method for ‘brick’ with signature ‘x="grf"’: no definition for class “grf”
in method for ‘brick’ with signature ‘x="SpatRaster"’: no definition for class “SpatRaster”
in method for ‘coerce’ with signature ‘"STFDF","RasterBrick"’: no definition for class “STFDF”
in method for ‘coerce’ with signature ‘"STSDF","RasterBrick"’: no definition for class “STSDF”
in method for ‘coerce’ with signature ‘"asc","RasterLayer"’: no definition for class “asc”
in method for ‘coerce’ with signature ‘"RasterLayer","asc"’: no definition for class “asc”
in method for ‘coerce’ with signature ‘"kasc","RasterBrick"’: no definition for class “kasc”
in method for ‘coerce’ with signature ‘"kasc","RasterStack"’: no definition for class “kasc”
in method for ‘coerce’ with signature ‘"kde","RasterLayer"’: no definition for class “kde”
in method for ‘coerce’ with signature ‘"grf","RasterBrick"’: no definition for class “grf”
in method for ‘coerce’ with signature ‘"grf","RasterLayer"’: no definition for class “grf”
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘raster’
in method for ‘extent’ with signature ‘x="sf"’: no definition for class “sf”
in method for ‘extract’ with signature ‘x="Raster",y="sf"’: no definition for class “sf”
in method for ‘mask’ with signature ‘x="Raster",mask="sf"’: no definition for class “sf”
in method for ‘raster’ with signature ‘x="sf"’: no definition for class “sf”
in method for ‘raster’ with signature ‘x="kasc"’: no definition for class “kasc”
in method for ‘raster’ with signature ‘x="asc"’: no definition for class “asc”
in method for ‘raster’ with signature ‘x="kde"’: no definition for class “kde”
in method for ‘raster’ with signature ‘x="grf"’: no definition for class “grf”
in method for ‘raster’ with signature ‘x="SpatRaster"’: no definition for class “SpatRaster”
in method for ‘rasterize’ with signature ‘x="sf",y="Raster"’: no definition for class “sf”
Creating a generic function for ‘rowSums’ from package ‘base’ in package ‘raster’
Creating a generic function for ‘colSums’ from package ‘base’ in package ‘raster’
in method for ‘setValues’ with signature ‘x="RasterLayerSparse"’: no definition for class “RasterLayerSparse”
in method for ‘spplot’ with signature ‘obj="SpatRaster"’: no definition for class “SpatRaster”
in method for ‘spplot’ with signature ‘obj="SpatVector"’: no definition for class “SpatVector”
in method for ‘stack’ with signature ‘x="kasc"’: no definition for class “kasc”
in method for ‘stack’ with signature ‘x="SpatRaster"’: no definition for class “SpatRaster”
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
sh: line 1: 69462 Segmentation fault: 11  R_TESTS= '/Library/Frameworks/R.framework/Resources/bin/R' --no-save --no-restore --no-echo 2>&1 < '/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T//Rtmp3WutjJ/file10e7f1b64a0fb'

 *** caught segfault ***
address 0x30, cause 'memory not mapped'

Traceback:
 1: Module(module, mustStart = TRUE, where = env)
 2: doTryCatch(return(expr), name, parentenv, handler)
 3: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 4: tryCatchList(expr, classes, parentenv, handlers)
 5: tryCatch(Module(module, mustStart = TRUE, where = env), error = function(e) e)
 6: loadModule(module = "spmod", what = TRUE, env = ns, loadNow = TRUE)
 7: (function (ns) loadModule(module = "spmod", what = TRUE, env = ns, loadNow = TRUE))(<environment>)
 8: doTryCatch(return(expr), name, parentenv, handler)
 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
10: tryCatchList(expr, classes, parentenv, handlers)
11: tryCatch((function (ns) loadModule(module = "spmod", what = TRUE, env = ns, loadNow = TRUE))(<environment>),     error = function(e) e)
12: eval(substitute(tryCatch(FUN(WHERE), error = function(e) e),     list(FUN = f, WHERE = where)), where)
13: eval(substitute(tryCatch(FUN(WHERE), error = function(e) e),     list(FUN = f, WHERE = where)), where)
14: .doLoadActions(where, attach)
15: methods::cacheMetaData(ns, TRUE, ns)
16: loadNamespace(package, lib.loc)
17: doTryCatch(return(expr), name, parentenv, handler)
18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
19: tryCatchList(expr, classes, parentenv, handlers)
20: tryCatch({    attr(package, "LibPath") <- which.lib.loc    ns <- loadNamespace(package, lib.loc)    env <- attachNamespace(ns, pos = pos, deps, exclude, include.only)}, error = function(e) {    P <- if (!is.null(cc <- conditionCall(e)))         paste(" in", deparse(cc)[1L])    else ""    msg <- gettextf("package or namespace load failed for %s%s:\n %s",         sQuote(package), P, conditionMessage(e))    if (logical.return)         message(paste("Error:", msg), domain = NA)    else stop(msg, call. = FALSE, domain = NA)})
21: library(pkg_name, lib.loc = lib, character.only = TRUE, logical.return = TRUE)
22: withCallingHandlers(expr, packageStartupMessage = function(c) tryInvokeRestart("muffleMessage"))
23: suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE))
24: doTryCatch(return(expr), name, parentenv, handler)
25: tryCatchOne(expr, names, parentenv, handlers[[1L]])
26: tryCatchList(expr, classes, parentenv, handlers)
27: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
28: try(suppressPackageStartupMessages(library(pkg_name, lib.loc = lib,     character.only = TRUE, logical.return = TRUE)))
29: tools:::.test_load_package("raster", "/Library/Frameworks/R.framework/Versions/4.0/Resources/library/00LOCK-raster/00new")
An irrecoverable exception occurred. R is aborting now ...
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/raster’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/raster’
Warning in install.packages :
  installation of package ‘raster’ had non-zero exit status

The downloaded source packages are in
	‘/private/var/folders/5_/l71sk6kn29z17n011g8kld5m0000gp/T/RtmpB8DDq4/downloaded_packages’

I just installed successfully under the same versions of Catalina and R. The difference is in our PATH for gcc. You are using a Homebrew gcc8, and I am using

 $ 506:  which gcc
/usr/bin/gcc
$ 505:  gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 $ 506:```

Unbrew (easy enough to change back).

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

Thanks, that did it!

1 Like