我正在Windows 7虚拟机上运行R 3.3的新安装,并尝试安装使用Rcpp的我自己的R软件包。该软件包可在GitHub上获得。我已经安装了Rtools Rcpp并且devtools
使用devtools::install_github("pbsag/tcadr"):
> devtools::install_github("pbsag/tcadr")
Downloading GitHub repo pbsag/tcadr@master
from URL https://api.github.com/repos/pbsag/tcadr/zipball/master
Installing tcadr
"C:/PROGRA~1/R/R-33~1.0/bin/x64/R" --no-site-file --no-environ --no-save \
--no-restore --quiet CMD INSTALL \
"C:/Users/Greg/AppData/Local/Temp/Rtmpwvw2qc/devtools1814572d2483/pbsag-tcadr-8ae1a82" \
--library="\\Mac/Home/Documents/R/win-library/3.3" --install-tests
* installing *source* package 'tcadr' ...
** libs
c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.0/include" -DNDEBUG -I"\\Mac/Home/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
RcppExports.cpp:4:18: fatal error: Rcpp.h: No such file or directory
#include <Rcpp.h>
^
compilation terminated.
make: *** [RcppExports.o] Error 1
Warning: running command 'make -f "C:/PROGRA~1/R/R-33~1.0/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-33~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="tcadr.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o get_df_from_binary.o write_df_to_binary.o"' had status 2
ERROR: compilation failed for package 'tcadr'
* removing '\\Mac/Home/Documents/R/win-library/3.3/tcadr'
Error: Command failed (1)
Run Code Online (Sandbox Code Playgroud)
克隆仓库并在Rstudio中构建:
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source tcadr
* installing to library '\\Mac/Home/Documents/R/win-library/3.3'
* installing *source* package 'tcadr' ...
** libs
c:/Rtools/mingw_64/bin/g++ -shared -s -static-libgcc -o tcadr.dll tmp.def RcppExports.o get_df_from_binary.o write_df_to_binary.o -Ld:/Compiler/gcc-4.9.3/local330/lib/x64 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-33~1.0/bin/x64 -lR
C:\Rtools\mingw_64\bin\nm.exe: RcppExports.o: File format not recognized
C:\Rtools\mingw_64\bin\nm.exe: get_df_from_binary.o: File format not recognized
C:\Rtools\mingw_64\bin\nm.exe: write_df_to_binary.o: File format not recognized
RcppExports.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'tcadr'
* removing '\\Mac/Home/Documents/R/win-library/3.3/tcadr'
Exited with status 1.
Run Code Online (Sandbox Code Playgroud)
这个问题有相同的错误,但是该接受的答案不适用,因为我的git储存库中没有任何编译的目标文件。
请注意,在Windows 7或Mac上的3.2中构建此程序包没有问题。
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.11.1
loaded via a namespace (and not attached):
[1] httr_1.1.0 R6_2.1.2 tools_3.3.0 withr_1.0.1 rstudioapi_0.5
[6] curl_0.9.7 memoise_1.0.0 git2r_0.15.0 digest_0.6.9
Run Code Online (Sandbox Code Playgroud)
我最近不得不在Windows服务器上处理同样的问题。该问题与Rtools版本需要为v3.4而不是v3.3才能使用R v3.3.0有关。
此外,您需要在重新安装前从系统PATH变量中删除旧的Rtools路径:
c:\Rtools\bin 和 c:\Rtools\gcc-4.x-y\bin
从https://cran.r-project.org/bin/windows/Rtools/下载Rtools
默认情况下,它看起来像Rtools 3.4。设置为在安装时包括以下两个路径:
c:\Rtools\bin
c:\Rtools\mingw_32\bin
Run Code Online (Sandbox Code Playgroud)
使用RTools几乎没有什么用,您拥有:
R toolsetCygwin DLLsR 3.3.x + 32 bit toolchainR 3.3.x + 64bit toolchain确保检查以上所有内容。
接下来,尝试自行安装软件包依赖项:
install.packages(c("Rcpp","dplyr","data.table","testthat"))
Run Code Online (Sandbox Code Playgroud)
从GitHub克隆存储库并打开项目文件后。尝试转到BuildRStudio中的标签,然后选择More-> Clean and Rebuild。