2016-05-26 77 views
0

我开发了Rcpp代码,它在Linux上编译,但我正在尝试Windows。Rcpp Windows失败编译

我安装了Rtools,路径已设置,路径似乎是正确的。

> Sys.getenv("PATH") 
[1] "C:\\Program Files\\R\\R-3.3.0\\bin\\x64;c:\\Rtools\\bin;c:\\Rtools\\gcc-4.6.3\\bin;c:\\MiKTeX\\miktex\\bin;c:\\Program Files\\R\\R-3.3.0\\bin\\;c:\\windows;c:\\windows\\system32;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32Files (x86)" 

我有G ++安装

> system("g++ -v") 
Using built-in specs. 
COLLECT_GCC=c:\Rtools\GCC-46~1.3\bin\G__~1.EXE 
COLLECT_LTO_WRAPPER=c:/rtools/gcc-46~1.3/bin/../libexec/gcc/i686-w64-mingw32/4.6.3/lto-wrapper.exe 
Target: i686-w64-mingw32 
Configured with: /data/gannet/ripley/Sources/mingw-test3/src/gcc/configure --host=i686-w64-mingw32 --build=x86_64-linux-gnu --target=i686-w64-mingw32 --with-sysroot=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --prefix=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/mingw32 --with- gmp=/data/gannet/ripley/Sources/mingw-test3/mingw32mingw32/prereq_install --with-mpfr=/data/gannet/ripley/Sources/mingw 
Thread model: win32 
gcc version 4.6.3 20111208 (prerelease) (GCC) 

制作也由Rtools

> system("where make") 
c:\Rtools\bin\make.exe 



system("R CMD INSTALL ./Sage_1.03.tar.gz") 
* installing to library 'C:/Users/Melannies/Documents/R/win-library/3.3' 
* installing *source* package 'Sage' ... 
** libs 
c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-33~1.0/include" -DNDEBUG  -I"C:/Users/Melannies/Documents/R/win-library/3.3/Rcpp/include" -I"C:/Users/Melannies/Documents/R/win-library/3.3/RcppArmadillo/include" -I"d:/Compiler/gcc-4.9.3/local330/include" `-IC:/Users/Melannies/Documents/R/win-library/3.3/Rcpp/include -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o 
Syntax error: EOF in backquote substitution 
make: *** [RcppExports.o] Error 2 
Warning: running command 'make -f "Makevars.win" -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="speedSage.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o aggregategsSumSigma.o bayesEstimation.o calcVIFarm_nosdalphaalt.o calcVIFarmalt.o notbayesEstimation.o sigmaArm.o sigmaSingle.o"' had status 2 
ERROR: compilation failed for package 'Sage' 
* removing 'C:/Users/Melannies/Documents/R/win-library/3.3/speedSage' 
    Warning message: 
running command 'R CMD INSTALL ./speedSage_1.03.tar.gz' had status 1 

所以我不知道错误RcppExports安装?我试图订阅Rcpp-Devel,但遇到了麻烦。

这里是Makevars.win

# Use the R_HOME indirection to support installations of multiple R version 
PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") 
PKG_CXXFLAGS=`$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::CxxFlags()") 

我有LinkingTo:在描述中,但我不知道如何充分利用LinkingTo

Package: Sage 
Type: Package 
Title: accelerated Client package 
Version: 1.04 

Depends: 
    Rcpp (>= 0.10.3), 
    RcppArmadillo (>= 0.3.810.2), 
    R (>= 2.15.0), 
    stats, 
    utils, 
    arkas 
Suggests: knitr, 
     roxygen2 
VignetteBuilder: knitr 
Maintainer: anthony colombo <[email protected]> 
Description: Computes the necessary statistics for analysis using R 
License: GPL (>= 2) 
LinkingTo: Rcpp, RcppArmadillo 
RoxygenNote: 5.0.1 
NeedsCompilation: yes 

回答

4

问题由下式给出:

Syntax error: EOF in backquote substitution

由于

` 

是在最后一行在Makevars.win开始:

PKG_CXXFLAGS=`$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::CxxFlags()") 

其切换到:

PKG_CXXFLAGS=$(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::CxxFlags()") 

,你应该是金色的。

顺便说一句...... You should switch over the LinkingTo: feature of Rcpp.由于这是很老派(vintage Rcpp?)的方式链接。

+0

哇谢谢。我今晚会再试一次,这很可能是解决方案。 – arcolombo

+1

现在用'devtools :: build_win()'试试! – coatless

+0

我将我的Linux软件包复制到Dropbox,然后将软件包下载到Windows系统,并失败。是否需要在Windows系统上构建软件包,才能安装在Windows操作系统上?谢谢。 – arcolombo