Rcpp11 / attributes

Standalone implementation of Rcpp attributes.
Other
3 stars 1 forks source link

Cannot compile under Windows and RStudio #27

Closed renkun-ken closed 10 years ago

renkun-ken commented 10 years ago
#include <Rcpp11>
using namespace Rcpp11;

// [[export]]
IntegerVector foo(){
  IntegerVector test {1, 2, 3} ;
  return test ;
}

In RStudio

library(Rcpp11)
library(attributes)
sourceCpp('test.cpp')

which ends up in error:

Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Users/Kun/AppData/Local/Temp/Rtmpon1XDW/file99011b92905.dll':
  LoadLibrary failure:  The specified module could not be found.
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-31~1.0/bin/x64/R CMD SHLIB "file99011b92905.cpp"' had status 1 

But the default RCpp template can compile with Rcpp without problem.

#include <Rcpp.h>
using namespace Rcpp;

// Below is a simple example of exporting a C++ function to R. You can
// source this function into an R session using the Rcpp::sourceCpp
// function (or via the Source button on the editor toolbar)

// For more on using Rcpp click the Help button on the editor toolbar

// [[Rcpp::export]]
int timesTwo(int x) {
   return x * 2;
}

My session info:

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Rcpp11_3.1.0.1.99 attributes_0.0   

loaded via a namespace (and not attached):
[1] Rcpp_0.11.2 tools_3.1.0

What might be the problem here?

romainfrancois commented 10 years ago

Does attributes::sourceCpp( "test.cpp", verbose = TRUE ) give you more information ?

renkun-ken commented 10 years ago
> attributes::sourceCpp("test.cpp",verbose = T)
C:/PROGRA~1/R/R-31~1.0/bin/x64/R CMD SHLIB "file195441a750d.cpp"
cygwin warning:
  MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.0/etc/x64/Makeconf
  Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-31~1.0/etc/x64/Makeconf
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
g++ -m64 -std=c++0x -I"C:/PROGRA~1/R/R-31~1.0/include" -DNDEBUG     -I"C:/Users/Kun/Documents/R/win-library/3.1/Rcpp11/include" -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O2 -Wall  -mtune=core2 -c file195441a750d.cpp -o file195441a750d.o
In file included from C:/Users/Kun/Documents/R/win-library/3.1/Rcpp11/include/Rcpp.h:58:0,
                 from C:/Users/Kun/Documents/R/win-library/3.1/Rcpp11/include/Rcpp11:4,
                 from file195441a750d.cpp:1:
C:/Users/Kun/Documents/R/win-library/3.1/Rcpp11/include/Rcpp/internal/interrupt.h:4:24: fatal error: Rinterface.h: No such file or directory
compilation terminated.
make: *** [file195441a750d.o] Error 1
Warning message:
running command 'make -f "C:/PROGRA~1/R/R-31~1.0/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-31~1.0/share/make/winshlib.mk" CXX='$(CXX1X) $(CXX1XSTD)' CXXFLAGS='$(CXX1XFLAGS)' CXXPICFLAGS='$(CXX1XPICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX1XLDFLAGS)' SHLIB_LD='$(SHLIB_CXX1XLD)' SHLIB="file195441a750d.dll" WIN=64 TCLBIN=64 OBJECTS="file195441a750d.o"' had status 2 
Error in inDL(x, as.logical(local), as.logical(now), ...) : 
  unable to load shared object 'C:/Users/Kun/AppData/Local/Temp/RtmpmGIMFg/file195441a750d.dll':
  LoadLibrary failure:  The specified module could not be found.
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-31~1.0/bin/x64/R CMD SHLIB "file195441a750d.cpp"' had status 1 
romainfrancois commented 10 years ago

Thanks. This helps. I'll try to reproduce it on my local windows machine today.

romainfrancois commented 10 years ago

I believe this was fixed by this commit in Rcpp11. https://github.com/Rcpp11/Rcpp11/commit/e66445f53409dac13c9af0cf73a481b1742fc716

Please update Rcpp11 and try again.

renkun-ken commented 10 years ago

The problem no longer exists! Thanks!