在Cygwin下在Windows中构建R软件包 [英] Build R package in Windows under Cygwin
问题描述
当尝试在Cygwin下从Win10上的源将R软件包dplyr更新到0.7.0时(dplyr 0.7.0的Windows二进制文件不可用.我的R安装不在Cygwin下,我的R安装来自二进制文件).但是当我跑步
When trying to update R package dplyr to 0.7.0 from source on Win10 under Cygwin (windows binary for dplyr 0.7.0 is not available. Also my R installation in not under Cygwin and my R installation is from binary). However when I run
R CMD INSTALL dplyr_0.7.0.tar.gz
看到以下错误:
* installing to library 'C:/Program Files/R/R-3.4.0/library'
* installing *source* package 'dplyr' ...
** package 'dplyr' successfully unpacked and MD5 sums checked
** libs
c:/Rtools/mingw_64/bin/g++ -I"C:/PROGRA~1/R/R-34~1.0/include" -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -DRCPP_USING_UTF8_ERROR_STRING -I"C:/Program Files/R/R-3.4.0/library/Rcpp/include" -I"C:/Program Files/R/R-3.4.0/library/BH/include" -I"C:/Program Files/R/R-3.4.0/library/bindrcpp/include" -I"C:/Program Files/R/R-3.4.0/library/plogr/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O2 -Wall -mtune=core2 -c RcppExports.cpp -o RcppExports.o
/bin/sh: c:/Rtools/mingw_64/bin/g++: No such file or directory
make: *** [C:/PROGRA~1/R/R-34~1.0/etc/x64/Makeconf:215: RcppExports.o] Error 127
Warning: running command 'make -f "Makevars.win" -f "C:/PROGRA~1/R/R -34~1.0/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-34~1.0/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="dplyr.dll" WIN=64 TCLBIN=64 OBJECTS="RcppExports.o address.o api.o arrange.o between.o bind.o combine_variables.o distinct.o filter.o group_by.o group_indices.o hybrid.o hybrid_count.o hybrid_debug.o hybrid_in.o hybrid_minmax.o hybrid_nth.o hybrid_offset.o hybrid_simple.o hybrid_window.o init.o init_register.o join.o join_exports.o mutate.o rlang-export.o select.o set.o slice.o summarise.o test.o utils.o window.o"' had status 2
ERROR: compilation failed for package 'dplyr'
* removing 'C:/Program Files/R/R-3.4.0/library/dplyr'
* restoring previous 'C:/Program Files/R/R-3.4.0/library/dplyr'
错误原因是R(使用Rtools库)在c:/Rtools/mingw_64/bin/下而不是Cygwin/usr/bin/
The cause of error is R (using Rtools library) looks for g++/gcc compilers under c:/Rtools/mingw_64/bin/ and not under Cygwin /usr/bin/
是否可以更改R CMD INSTALL的默认行为,从而允许在没有Rtoools的情况下在Windows中从源代码构建R包?
Is there a way to change this default behavior of R CMD INSTALL which would allow building R packages from source in Windows without Rtoools?
谢谢
PS.我认为这篇文章您如何使用cygwin从源代码编译R包?是相关的,但看来R已安装在Cygwin下,这不是我的情况.
PS. I think this post how do you use cygwin to compile an R package from source? is relevant, but it appears R was installed under Cygwin, which is not my case.
PPS.看来我需要更改在
PPS. It appears I need to change variables defined under
R CMD config
有什么想法吗?
推荐答案
我不确定什么是最好的解决方案.但是您当然可以通过修改 $(R_HOME)/etc/x64/Makeconf
中的BINPREF来解决此问题. c:/Rtools/mingw_64/bin/
是默认值.
I'm not sure what the best solution is. But you can certainly fix this by modifying BINPREF in $(R_HOME)/etc/x64/Makeconf
. c:/Rtools/mingw_64/bin/
is the default value.
PS:您几乎可以肯定 可以使用cygwin编译器来构建R包,只要只涉及C链接即可.我在Visual Studio下构建了我的一些.
PS: You almost certainly can use the cygwin compiler to build R packages, as long as only C linkage is involved. I build some of mine under Visual Studio.
这篇关于在Cygwin下在Windows中构建R软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!