Search code examples
rinstallationcygwinrcpp

Rcpp, Rtools, and cygwin: failing to install Rcpp


First try, within cygwin with R 3.1.3 installed:

>PATH=/usr/local/bin:/usr/bin

In R:

>install.packages("Rcpp",repos="http://cran.us.r-project.org")

yields an error

[...]
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lpcre
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -llzma
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lbz2
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lz
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -liconv
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -licuuc
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -licui18n
collect2: error: ld returned 1 exit status
/usr/lib/R/share/make/shlib.mk:6: recipe for target 'Rcpp.dll' failed
make: *** [Rcpp.dll] Error 1
ERROR: compilation failed for package ‘Rcpp’
* removing ‘/usr/lib/R/site-library/Rcpp’

So I try installing Rtools 3.2. As instructed for cygwin install, I don't install cygwin's dll that are included in Rtools. Then

>PATH=/cygdrive/c/Rtools/bin:/cygdrive/c/Rtools/gcc-4.6.3/bin:$PATH

which, in R, yields a silent non-zero status exit when trying to do the installation

Installing package into ‘/usr/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/Rcpp_0.11.6.tar.gz'
Content type 'application/x-gzip' length 2352221 bytes (2.2 MB)
opened URL
==================================================
downloaded 2.2 MB


The downloaded source packages are in
        ‘/tmp/Rtmp71eoxd/downloaded_packages’
Warning message:
In install.packages("Rcpp", repos = "http://cran.us.r-project.org") :
  installation of package ‘Rcpp’ had non-zero exit status

Verbose mode is not more informative. I searched a long time, but I am at a loss now. Somebody has an idea? Thanks


Solution

  • I was getting frustrated dealing with the same errors. In the Cygwin installation 'Select Packages' window, search for each of these libraries and install them. For example: pcre, lzma, bz2, ... I was finally able to compile after installing all of these.