3

The Window HPC server in my lab does not have Rtools, so I've got this message when I sourced the Rcpp code.

Warning message:
running command 'make -f "C:/PROGRA~1/R/R-32~1.2/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-32~1.2/share/make/winshlib.mk" SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)' SHLIB="sourceCpp_1.dll" WIN=64 TCLBIN=64 OBJECTS="MultiBayes.v1.o"' had status 127 
Error in sourceCpp("./rcode/MultiBayes.v1.cpp") : 
  Error 1 occurred building shared library.

WARNING: The tools required to build C++ code for R were not found.

Please download and install the appropriate version of Rtools:

http://cran.r-project.org/bin/windows/Rtools/

Execution halted

Since the administrative staff says it might take long time to install Rtools in the server, I'm wondering if there is another way to escape this problem and run the Rcpp code without installing Rtools.

As far as I know, building a package would not be helpful since it also uses Rtools when installing it. Please correct me if wrong.

Can I detour this to run the code?

Thanks for any comments and ideas.

inmybrain
  • 386
  • 3
  • 16

2 Answers2

6

Briefly:

  1. The narrow answer is that "yes, in theory you get by without Rtools" if you happened to install binary-identical version (including patches) of gcc et al. In practice, you cannot (on Windows).

  2. An easy way around is to compile a package of your code outside of the HPC server and deploy the binary build of that package on it. Easy. And no Rtools needed for binaries!

  3. If you do HPC you may also want to look into Linux.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
0

Thanks to Dirk Eddelbuettel, I go on the solution 2 to handle my problem

Here's what I did.

  1. Build the R package including .cpp code, and create the package source (e.g. YourPkgName_1.0.tar.gz)

  2. Install the package to create the library in your desktop. For example,

    install.packages(pkgs = "C:/Users/User/Desktop/YourPkgName_1.0.tar.gz", repos = NULL, type="source")

  3. Move your installed library from the default folder (your desktop) to the server. My local url was

    C:\Program Files\R\R-3.5.1\library

  4. You can load the cpp function in R under your server where Rtools is not installed by including the following command in your R script.

    library("YourPkgName", lib.loc = "YourPersonalLibraryDirectory")

inmybrain
  • 386
  • 3
  • 16