coatless-mac / r-macos-rtools

Scripts to build an **unofficial** Rtools-esq installer for the macOS R toolchain
171 stars 6 forks source link

Better Stan support #22

Closed coatless closed 5 years ago

coatless commented 5 years ago

From Dealing with Catalina and Dealing with Catalina II, we need to modify how the compiler is setup to ease the C++ exception issue.

@bgoodri seems to have found a good option here:

CXX14 = /usr/local/clang7/bin/clang++ -stdlib=libc++ -nostdinc++ -I/usr/local/clang7/include/c++/v1
SHLIB_CXX14LD = /usr/local/clang7/bin/clang++ -L/usr/local/clang7/lib/

Note, the -nostdinc++ is disabling standard directorys, c.f. https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html

-nostdinc
Do not search the standard system directories for header files. Only the directories explicitly specified with -I, -iquote, -isystem, and/or -idirafter options (and the directory of the current file, if appropriate) are searched.

-nostdinc++
Do not search for header files in the C++-specific standard directories, but do still search the other standard directories. (This option is used when building the C++ library.)
coatless commented 5 years ago

Opted against this solution. Instead, I implemented Sebastian's ABI reference, c.f.

SHLIB_CXXLDFLAGS+=-Wl,-rpath,${R_HOME}/lib ${R_HOME}/lib/libc++abi.1.dylib