Hi,
I am trying to install Rstan on my 10.13.6 High Sierra mac, with 3.5.1 ‘Feather Spray’ R version and a 1.1.419 Rstudio version, following the instructions for ‘Installing RStan on Mac or Linux’ on the rstan github page. I also posted this question on stackoverflow but wonder if this is a better forum for this question?
Because the macOS R toolchain installer kept giving an error during installation, I opted for the manual steps described here.
On my first attempt I simply updated my Xcode and followed the instructions, but as this did not seemed to work, I removed Xcode (also from my bin as suggested here) and reinstalled Xcode 10.1 (10B61), and accepted the license by running ‘sudo xcodebuild -license’ in the terminal as described here.
The command line tools seem available as running
> system('clang++ -v')
gives this output:
Apple LLVM version 10.0.0 (clang-1000.11.45.5) Target:
x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
In the next step I ran the chunk of code for the configuration of clang++, after which running this line:
# print the contents to the console
> cat(readLines(MAKEVARS), sep = "\n")
resulted into this:
LDFLAGS= -L/usr/local/clang4/lib # The following statement changes
the Fortran linking path
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0 #
End Fortran linking path statement # The following statement changes
the Fortran linking path
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0 #
End Fortran linking path statement CC=/usr/local/clang4/bin/clang
CXX=/usr/local/clang4/bin/clang++ CXX1X=/usr/local/clang4/bin/clang++
CXX98=/usr/local/clang4/bin/clang++
CXX11=/usr/local/clang4/bin/clang++
CXX14=/usr/local/clang4/bin/clang++
CXX17=/usr/local/clang4/bin/clang++ # The following statement
changes the Fortran linking path
FLIBS=-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin16/6.3.0 #
End Fortran linking path statement
CXX14FLAGS=-O3 -mtune=native -march=native -Wno-unused-variable
-Wno-unused-function -Wno-unknown-pragmas CC=clang CXX14=clang++ -arch x86_64 -ftemplate-depth-256
CXX14FLAGS=-O3 -mtune=native -march=native -Wno-unused-variable
-Wno-unused-function -Wno-unknown-pragmas CC=clang CXX14=clang++ -arch x86_64 -ftemplate-depth-256
Next, I installed the pkgbuild package as according to the instructions, and the next instructions were to run:
pkgbuild::has_build_tools(debug = TRUE)
To check that pkgbuild believes your toolchain is working. It also states:
If this returns FALSE, then go back to the previous section and install a toolchain correctly.
Upon running the line, I am prompted by Rstudio with this comment:
Building R package from source requires installation of additional build tools. Do you want to install the additional tools now?
If I click ‘no’ on the question whether I want to install the additional tools, R returns:
[1] FALSE
If I click ‘yes’ I arrive at this page. I have followed the instructions on that page to download and install the command line tools from Apple’s developer page (the second option mentioned), it made no difference and I am still prompet that additional build tools are required when checking the pkgbuild line. Trying through terminal running:
xcode-select --install
results in:
error: command line tools are already installed, use "Software Update"
to install updates
However, there are no software updates in my app store.
If I continue to run the next step of the instructions (so ignoring the pkgbuild error):
> fx <- inline::cxxfunction( signature(x = "integer", y = "numeric" ) , '
+ return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ;
+ ' )
I get this output:
/Library/Frameworks/R.framework/Resources/bin/R: line 142:
/Library/Frameworks/R.framework/Resources/etc/x86_64/ldpaths: No such
file or directory
ERROR(s) during compilation: source code errors or compiler
configuration errors!
Program source: 1: 2: // includes from the plugin 3: #include
<R.h> 4: #include <Rdefines.h> 5: #include <R_ext/Error.h> 6:
7: 8: // user includes 9: 10: 11: // declarations 12: extern
"C" { 13: SEXP file758212ccc99c( SEXP x, SEXP y) ; 14: } 15: 16:
// definition 17: 18: SEXP file758212ccc99c( SEXP x, SEXP y ){ 19:
20: return ScalarReal( INTEGER(x)[0] * REAL(y)[0] ) ; 21:
22: Rf_warning("your C++ program does not return anything"); 23:
return R_NilValue ; 24: } 25: 26: Error in compileCode(f, code,
language = language, verbose = verbose) : Compilation ERROR,
function(s)/method(s) not created!
/Library/Frameworks/R.framework/Resources/bin/R: line 142:
/Library/Frameworks/R.framework/Resources/etc/x86_64/ldpaths: No such
file or directory In addition: Warning message: In system(cmd, intern
= !verbose) : running command '/Library/Frameworks/R.framework/Resources/bin/R CMD SHLIB
file758212ccc99c.cpp 2> file758212ccc99c.cpp.err.txt' had status 1
This makes me think maybe something is wrong with the path to the Rtools is that correct? My apologies if I am doing something obviously wrong or there is already a thread on this, but I could not find input on previous issues on this (pkgbuild check) stage of the process, and would highly appreciate any input of what I can try next!
If I should just remove everything (also Rstudio and R?) from my laptop I would also appreciate advise on how to make sure everything from these failed attempts is gone if possible, as I think I might have done that wrong last time?
Thank you!