2

I have updated Xcode and MacOS operating system to Monterey and now I am having a series of issues of making Rstudio to work as used to do.

In particular, now I am getting an error when I try to source with Rcpp the code described in Rcpp with quad precision computation.

This is the error I get:

In file included from /usr/local/gfortran/include/c++/12.1.0/cmath:47,
                 from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100,
                 from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp/r/headers.h:62,
                 from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/RcppCommon.h:30,
                 from /Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp.h:27,
                 from quadexp.cpp:2:
/usr/local/gfortran/include/c++/12.1.0/bits/std_abs.h:38:15: fatal error: stdlib.h: No such file or directory
   38 | #include_next <stdlib.h>
      |               ^~~~~~~~~~
compilation terminated.
make: *** [quadexp.o] Error 1

Do you have any idea of what does it mean? I checked in /usr/local/gfortran/include/c++/12.1.0/bits and stdlib.h is present.

This is my ~/.R/Makevars:

LOC=/usr/local/gfortran
CC=$(LOC)/bin/gcc -fopenmp
CXX=$(LOC)/bin/g++ -fopenmp
CXX11 = $(LOC)/bin/g++ -fopenmp

CFLAGS=-g -O3 -Wall -pedantic -std=gnu99 -mtune=native -pipe
CXXFLAGS=-g -O3 -Wall -pedantic -std=c++11 -mtune=native -pipe -I/usr/local/opt/llvm/include
LDFLAGS=-L$(LOC)/lib -Wl,-rpath,$(LOC)/lib,-L/usr/local/lib
CPPFLAGS=-I$(LOC)/include -I/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/include 

FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin19/10.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CXX1X=/usr/local/gfortran/bin/g++
CXX98=/usr/local/gfortran/bin/g++
CXX11=/usr/local/gfortran/bin/g++
CXX14=/usr/local/gfortran/bin/g++
CXX17=/usr/local/gfortran/bin/g++
jonsca
  • 10,218
  • 26
  • 54
  • 62
CafféSospeso
  • 1,101
  • 3
  • 11
  • 28
  • If memory serves we have only seen `#include_next` errors on incomplete or non-working setups where different compiler and C++ library versions were mixed. Not having provided a complete or reproducible example there is very little more we can say at this point. – Dirk Eddelbuettel Jun 16 '22 at 22:29
  • Thanks @DirkEddelbuettel for the comment. I do not see how I can provide a reproducible example in this case. Tell me if you have any suggestion. – CafféSospeso Jun 16 '22 at 22:32
  • One of the things I have done was to remove Rstudio and re-install it using `brew install --cask rstudio`. I do not know whether this has something to do with my issue. – CafféSospeso Jun 16 '22 at 23:55
  • Do you get the same error if you remove "-I/usr/local/opt/llvm/include" from CXXFLAGS and add it to CPPFLAGS? – jared_mamrot Jun 17 '22 at 00:38
  • Completely deleting my `~/.R/.Makevars` files fixed this for me. Not necessarily going to recommend for everyone but it was almost empty anyway. – Noah Mar 21 '23 at 20:15

0 Answers0