When I knit a pdf using rmarkdown, it always return such error:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4.1-MRO/Resources/library/Rcpp/libs/Rcpp.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.4.1-MRO/Resources/library/Rcpp/libs/Rcpp.so, 6): Library not loaded: /usr/local/clang4/lib/libc++abi.dylib
Referenced from: /Library/Frameworks/R.framework/Resources/lib/libc++.1.dylib
Reason: image not found
Calls: :: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
sessionInfo():
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets
[6] methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 backports_1.1.0 magrittr_1.5
[4] RevoUtils_10.0.5 rprojroot_1.2 htmltools_0.3.6
[7] tools_3.4.1 yaml_2.1.14 Rcpp_0.12.12
[10] stringi_1.1.5 rmarkdown_1.6 knitr_1.17
[13] stringr_1.2.0 digest_0.6.12 evaluate_0.10.1
Not an _Rcpp_ problem. Toolchain issue. Does:
Rcpp::evalCpp("1+1")
give the correct answer?
That's peculiar because @coatless and I have been working A LOT on rmarkdown use lately. And he uses macOS. And he just beat me...
Library not loaded: /usr/local/clang4/lib/libc++abi.dylib
You probably just have a hash of pre-built and locally-built components. "If it breaks, rebuild."
It seems like a problem of clang. How could I fix it?
> Rcpp::evalCpp('1+1')
/bin/sh: /usr/local/clang4/bin/clang++: No such file or directory
make: *** [file3e76680fbd3c.o] Error 127
/usr/local/clang4/bin/clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.4.1-MRO/Resources/library/Rcpp/include" -I"/private/var/folders/1v/wz_prgn52n91b5x1byjxwnl00000gn/T/RtmpXqL3rj/sourceCpp-x86_64-apple-darwin15.6.0-0.12.12" -DU_STATIC_IMPLEMENTATION -Wall -mtune=core2 -g -O2 -I/opt/X11/include -fPIC -DU_STATIC_IMPLEMENTATION -Wall -mtune=core2 -g -O2 -I/opt/X11/include -c file3e76680fbd3c.cpp -o file3e76680fbd3c.o
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error 1 occurred building shared library.
You can get the necessary compiler here:
https://github.com/coatless/r-macos-clang
@eddelbuettel please close the ticket.
@coatless it works. Thank you!
Most helpful comment
You can get the necessary compiler here:
https://github.com/coatless/r-macos-clang
@eddelbuettel please close the ticket.