For instance, installing {testthat} version 3.1.4 via renv::install("[email protected]")
from an package snapshot using R 4.3.2 on Intel macOS Sonoma 14.6.1 gives:
Error: Error installing package 'testthat':
====================================
* installing *source* package ‘testthat’ ...
** package ‘testthat’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
using C compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’
using C++ compiler: ‘Apple clang version 15.0.0 (clang-1500.3.9.4)’
using SDK: ‘MacOSX14.4.sdk’
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c init.c -o init.o
clang -arch x86_64 -I"/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c reassign.c -o reassign.o
clang++ -arch x86_64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c test-catch.cpp -o test-catch.o
clang++ -arch x86_64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c test-example.cpp -o test-example.o
clang++ -arch x86_64 -std=gnu++17 -I"/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/include" -DNDEBUG -I../inst/include -DCOMPILING_TESTTHAT -I/opt/R/x86_64/include -fPIC -falign-functions=64 -Wall -g -O2 -c test-runner.cpp -o test-runner.o
...
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__random/uniform_int_distribution.h:237:5: error: static assertion failed due to requirement '__libcpp_random_is_valid_urng<Catch::RandomNumberGenerator, void>::value':
static_assert(__libcpp_random_is_valid_urng<_URNG>::value, "");
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/shuffle.h:154:35: note: in instantiation of function template specialization 'std::uniform_int_distribution<long>::operator()<Catch::RandomNumberGenerator>' requested here
difference_type __i = __uid(__g, _Pp(0, __d));
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__algorithm/shuffle.h:166:14: note: in instantiation of function template specialization 'std::__shuffle<std::_ClassicAlgPolicy, std::__wrap_iter<Catch::TestCase *>, std::__wrap_iter<Catch::TestCase *>, Catch::RandomNumberGenerator &>' requested here
(void)std::__shuffle<_ClassicAlgPolicy>(
^
../inst/include/testthat/vendor/catch.h:7189:18: note: in instantiation of function template specialization 'std::shuffle<std::__wrap_iter<Catch::TestCase *>, Catch::RandomNumberGenerator &>' requested here
std::shuffle( vector.begin(), vector.end(), rng );
^
../inst/include/testthat/vendor/catch.h:7207:44: note: in instantiation of function template specialization 'Catch::RandomNumberGenerator::shuffle<std::vector<Catch::TestCase>>' requested here
RandomNumberGenerator::shuffle( sorted );
^
1 error generated.
make: *** [test-runner.o] Error 1
ERROR: compilation failed for package ‘testthat’
My clang:
$ clang --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: x86_64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Should I switch to a different compiler? Installed via homebrew, perhaps?
1