I know lots of people are having trouble installing Rcpp on OS X Catalina (10.15.4). I seem to have found a bit of a new problem perhaps.
My error is nearly identical to Cannot compile R packages with c++ code after updating to macOS Catalina
However, I am using R version 4.0.0 (without going backwards) is it possible to fix?
Long Version
I followed these instructions: https://thecoatlessprofessor.com/programming/cpp/r-compiler-tools-for-rcpp-on-macos/
- I removed old files
- I reinstalled Xcode commandline tools
- gcc --version returns:
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.0 (clang-1100.0.33.12)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
- I installed gfortran 8.2
- I go to run the "quick check" hello_world.cpp
In R:
install.packages(c('Rcpp', 'RcppArmadillo'))
I go to run the hello_world.cpp example (in RStudio 1.2.5033)... and I get:
> Rcpp::sourceCpp('Downloads/helloworld.cpp')
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:314:9: error: no member named 'signbit' in the global namespace
using ::signbit;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:315:9: error: no member named 'fpclassify' in the global namespace
using ::fpclassify;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:316:9: error: no member named 'isfinite' in the global namespace; did you mean 'finite'?
using ::isfinite;
~~^
/usr/local/include/math.h:749:12: note: 'finite' declared here
extern int finite(double)
^
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'isinf' in the global namespace
using ::isinf;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:318:9: error: no member named 'isnan' in the global namespace
using ::isnan;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:319:9: error: no member named 'isnormal' in the global namespace
using ::isnormal;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:320:9: error: no member named 'isgreater' in the global namespace
using ::isgreater;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:321:9: error: no member named 'isgreaterequal' in the global namespace
using ::isgreaterequal;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:322:9: error: no member named 'isless' in the global namespace
using ::isless;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:323:9: error: no member named 'islessequal' in the global namespace
using ::islessequal;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:324:9: error: no member named 'islessgreater' in the global namespace
using ::islessgreater;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:325:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:326:9: error: no member named 'isunordered' in the global namespace
using ::isunordered;
~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:332:9: error: no member named 'abs' in the global namespace; did you mean 'fabs'?
using ::abs;
~~^
/usr/local/include/math.h:417:15: note: 'fabs' declared here
extern double fabs(double);
^
In file included from helloworld.cpp:1:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Users/Justin/Library/R/4.0/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/RcppCommon.h:29:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/r/headers.h:67:
In file included from /Users/Justin/Library/R/4.0/library/Rcpp/include/Rcpp/platform/compiler.h:100:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:28: error: expected a qualified name after 'typename'
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:37: error: expected ';' at end of declaration
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:552:37: error: expected unqualified-id
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:564:39: error: use of undeclared identifier 'is_floating_point'
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:564:57: error: '_A1' does not refer to a value
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:562:17: note: declared here
template <class _A1>
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [helloworld.o] Error 1
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I"/Users/Justin/Library/R/4.0/library/Rcpp/include" -I"/Users/Justin/Library/R/4.0/library/RcppArmadillo/include" -I"/Users/Justin/Downloads" -I/usr/local/include -fPIC -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -c helloworld.cpp -o helloworld.o
Error in Rcpp::sourceCpp("Downloads/helloworld.cpp") :
Error 1 occurred building shared library.
Any help would be much appreciated.