coatless-mac/r-macos-rtools

Failure to read math.h

kcrum opened this issue · 2 comments

kcrum commented

Hello! I was unsuccessfully attempting to install rstanarm on Mac OSX 10.15.3, and I was instructed to use this toolchain to fix the issue I was encountering.

Unfortunately, after installing the C++ toolchain and attempting to install rstanarm in a fresh session, compilation failed reading the math.h header:

In file included from /usr/local/clang7/include/c++/v1/cmath:305:
/usr/local/clang7/include/c++/v1/math.h:301:15: fatal error: 'math.h' file not found
#include_next <math.h>
^~~~~~~~

1 error generated.
make: *** [stan_files/bernoulli.o] Error 1
rm stan_files/bernoulli.cc
ERROR: compilation failed for package ‘rstanarm’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rstanarm’
  • restoring previous
    ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rstanarm’

As the error suggests, there is a file at /usr/local/clang7/include/c++/v1/math.h that attempts to include another file called math.h on line 301. Does anyone have any idea how or why math.h might fail to read another file called math.h?

In R, please:

cat("~/.R/Makevars")
cat("~/.Renviron")

Provide the results here. (Note: Avoid showing any tokens if in ~/.Renviron)

Outside of that, consider opening Terminal and typing:

sudo xcode-select --install

You may not have been on a stable internet connection or Apple may have rotated their server binary.

kcrum commented

It turns out calling xcode-select --install was enough. Thank you for your response!