RccpGSL,installing/using 来自 windows 7 上的 R 的 GSL

RccpGSL, installing/using GSL from R on windows 7

我习惯了 R,但我是 C++ 的初学者。我很难安装 GSL 以将其与 R 中的 RcppGSL 一起使用,以改进包含 C++ 代码的包。我下载了最新的 GSL 版本,将其解压缩到 C:/GSL,将环境变量 LIB_GSL 设置为 C:/GSL,将 PATH 设置为 C:/GSL/bin

就像我说的,我想改进现有的包。我已经从 github 中分叉并提取了相关软件包的最新版本。我的主要目标只是能够使用和改进包。但是,当我尝试从源文件中制作源包时,出现以下错误:

Installing to library 'C:/Users/Simon/Documents/R/win-library/3.1'
* installing *source* package 'Rflim' ...
** libs
g++ -m64 -I"C:/PROGRA~1/R/R-31~1.2/include" -DNDEBUG    -I"C:/Users/Simon/Documents/R/win-library/3.1/Rcpp/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include"  -IC:/Users/Simon/Documents/R/win-library/3.1/Rcpp/include -I/usr/local/include -I C:/Users/Simon/Documents/R/win-library/3.1/RcppGSL/include   -O2 -Wall  -mtune=core2 -c flim.cpp -o flim.o
In file included from C:/Users/Simon/Documents/R/win-library/3.1/RcppGSL/include/RcppGSL.h:23:0,
                 from flim.cpp:1:
C:/Users/Simon/Documents/R/win-library/3.1/RcppGSL/include/RcppGSLForward.h:26:29: fatal error: gsl/gsl_vector.h: No such file or directory
compilation terminated.
make: *** [flim.o] Error 1
Warnung: Ausf�hrung von Kommando 'make -f "Makevars" -f "C:/PROGRA~1/R/R-31~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.2/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="Rflim.dll" WIN=64 TCLBIN=64 OBJECTS="flim.o"' ergab Status 2
ERROR: compilation failed for package 'Rflim'
* removing 'C:/Users/Simon/Documents/R/win-library/3.1/Rflim'

Exited with status 1.

抱歉,里面有几个德语单词: 警告:Ausf�hrung von Kommando==警告:正在执行命令

我意识到 R 正试图通过 RcppGSL 路径访问 GSL 库。那是对的吗?它不应该直接转到 C:/GSL 吗?我还意识到 R 正试图从 Rcpp 和 RcppGSL 转到路径,但我不明白为什么...

如有任何关于如何解决问题的说明或建议,我将不胜感激。

谢谢!!!

请从 support site provided by Prof Ripley 在 Windows 安装 R 的预构建 GSL 版本,然后在 src/Makevars.win

中相应地设置这些值
## This assumes that the LIB_GSL variable points to working GSL libraries
PKG_CPPFLAGS=-I$(LIB_GSL)/include -I../inst/include
PKG_LIBS=-L$(LIB_GSL)/lib -lgsl -lgslcblas 

要么直接,要么相应地设置 LIB_GSL

这就是 CRAN 构建程序包的方式,并且它显然有效。