title: Build R package in Windows under Cygwin
body: <p>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</p>
  
  <pre><code>R CMD INSTALL dplyr_0.7.0.tar.gz
  </code></pre>
  
  <p>see the following error:</p>
  
  <pre><code>* 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'
  </code></pre>
  
  <p>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/</p>
  
  <p>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?</p>
  
  <p>Thanks</p>
  
  <p>PS. I think this post
  <a href="https://stackoverflow.com/questions/36416543/how-do-you-use-cygwin-to-compile-an-r-package-from-source/44474950#44474950">how do you use cygwin to compile an R package from source?</a>
  is relevant, but it appears R was installed under Cygwin, which is not my case.</p>
  
  <p>PPS. It appears I need to change variables defined under</p>
  
  <pre><code>R CMD config
  </code></pre>
  
  <p>Any ideas how?</p>