Closed zhiruiwang closed 6 years ago
Do you have a minimal reproducible example? Or do you mean this happens to all R Markdown documents?
You seem to be using Microsoft R Open, which could be a possible reason.
And is everything up-to-date? e.g. update.packages(ask = FALSE, checkBuilt = TRUE)
. Can you try to reinstall Rcpp if that does not fix your issue?
It seems like a problem of Rcpp and its compiler clang. Do you know 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.
See the following link how it is fixed: https://github.com/RcppCore/Rcpp/issues/751
@yihui : If possible, could you add additional checks to the Rcpp engine for both macOS and windows?
For macOS:
Starting with R 3.4.*, the toolchain for macOS changed (e.g. /usr/local/clang4
).
For Windows:
Users need to have Rtools on the PATH
. However, the default installer does not require this change. Thus, we get errors on StackOverflow of:
Let me know if you would prefer I open a new ticket...
I don't think we should request any work from @yihui here. From what I can tell, binaries of Rcpp distributed by CRAN link to the copy of libc++
provided by R, so I don't know how @zhiruiwang got himself into this state.
kevin@cdrv:~/Library/R/3.4/library/Rcpp/libs
$ otool -L Rcpp.so
Rcpp.so:
Rcpp.so (compatibility version 0.0.0, current version 0.0.0)
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libR.dylib (compatibility version 3.4.0, current version 3.4.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1259.11.0)
/Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
(maybe @zhiruiwang is using a checkpointed version of MRAN that's serving broken copies of Rcpp? I recall that was an issue briefly in the past, but CRAN quickly fixed the issue)
@kevinushey who would be the best person (or place) for this request? It's one of the biggest barriers of entry when coupling compiled code with the literate programming workflow that students are being encouraged to take.
@kevinushey I am using the following repo to download R packages, I think it is still up an up-to-date CRAN mirror?
options(repos = c(CRAN = "https://cran.revolutionanalytics.com"))
After I install the clang4 from this link: https://github.com/coatless/r-macos-clang, everything is solved. I checked the /usr/local/clang4 directory beforehand, there was only a lib folder under the directory, and only 4 dylib files under the lib. I do not know whether it is my own mac's problem, or all other mac has the same issue with their clang4.
The copy of Rcpp distributed from that CRAN mirror seems to work fine for me as well, and it also seems to work fine with a newly installed version of MRO on my macOS machine, so I suspect the issue you're encountering may be local (but I don't know what the underlying cause might be).
@coatless you might consider submitting a PR to knitr
(assuming that Yihui would be willing to review that).
@kevinushey sounds good! More than happy to address this as it is frequently one of the top issues during OHs later in the semester... Despite plastering warnings, creating install guides, and even an installer... C'est la vie.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
When I knit a pdf using rmarkdown, it always return such error:
sessionInfo():