您可以忽略此处的所有devtools
个调用以及对RStudio的所有引用:这些只是添加的层.Everything最终会呼叫R CMD INSTALL
,因此您可以直接拨打.
简而言之,您的文件可能有错误的变量.下面是最小的一个(作为我的一个实际子集,我用它在gcc
和clang
之间切换)
CLANGVER=-15
CLANGLIB=-stdlib=libc++
CXX=$(CCACHE) clang++$(CLANGVER) $(CLANGLIB)
CXX11=$(CCACHE) clang++$(CLANGVER) $(CLANGLIB)
CXX14=$(CCACHE) clang++$(CLANGVER) $(CLANGLIB)
CXX17=$(CCACHE) clang++$(CLANGVER) $(CLANGLIB)
CXX20=$(CCACHE) clang++$(CLANGVER) $(CLANGLIB)
CC=$(CCACHE) clang$(CLANGVER)
SHLIB_CXXLD=clang++$(CLANGVER) $(CLANGLIB)
CXXFLAGS=-Wall -O3 -pedantic
CXX11FLAGS=-Wall -O3 -pedantic
CXX14FLAGS=-Wall -O3 -pedantic
CXX17FLAGS=-Wall -O3 -pedantic
CXX20FLAGS=-Wall -O3 -pedantic
我用CLANGVER
,因为Ubuntu通常给我一个 Select ,我用VER
代表gcc
.通常设置为CCACHE
(设置为ccache
),但您也可以在没有它的情况下使用它,如以下程序包中的完整日志(log)所示:
edd@rob:~/git/rcppexamples(master)$ ./cleanup; install.r # install.r wraps R CMD INSTALL
* installing *source* package found in current working directory ...
* installing *source* package ‘RcppExamples’ ...
** using staged installation
** libs
using C++ compiler: ‘Ubuntu clang version 15.0.7’
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c DataFrameExample.cpp -o DataFrameExample.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c DateExample.cpp -o DateExample.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c FactorExample.cpp -o FactorExample.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c ListExample.cpp -o ListExample.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c MatrixExample.cpp -o MatrixExample.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c NumericVectorExample.cpp -o NumericVectorExample.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c RNGs.cpp -o RNGs.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c RcppExports.cpp -o RcppExports.o
clang++-15 -stdlib=libc++ -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -fpic -Wall -O3 -pedantic -c StringVectorExample.cpp -o StringVectorExample.o
clang++-15 -stdlib=libc++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o RcppExamples.so DataFrameExample.o DateExample.o FactorExample.o ListExample.o MatrixExample.o NumericVectorExample.o RNGs.o RcppExports.o StringVectorExample.o -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-rcppexamples/00new/RcppExamples/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (RcppExamples)
edd@rob:~/git/rcppexamples(master)$
因此,简而言之,你使用了错误的变量.它们不同于我们必须在包裹中使用的内容,以及它们的src/Makevars
和~/.R/Makevars
中的内容.这里没有前缀PKG_
,‘global’优先于R在它自己的$RHOME/etc/Makeconf
中的前缀.