Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
101 views
in Technique[技术] by (71.8m points)

c++ - Problem with compiling RInside examples under Windows

I am trying to setup RInside at work where we are forced to use a Windows environment.

I have installed RTools and downloaded an RInside binary from CRAN.

My R installation resides in c:RR-2.12.2 so no problems with folders with spaces.

I have installed the Rcpp and RInside packages in R.

I execute the following makefile Makefile.win included in the downloaded RInside binary

## -*- mode: makefile; tab-width: 8; -*-
##
## Simple Makefile
##
## TODO:
##  proper configure for non-Debian file locations,   [ Done ]
##  allow RHOME to be set for non-default R etc

## comment this out if you need a different version of R,
## and set set R_HOME accordingly as an environment variable
R_HOME :=       'cygdrive/c/R/R-2.12.2'

sources :=      $(wildcard *.cpp)
programs :=         $(sources:.cpp=)

## include headers and libraries for R
RCPPFLAGS :=        $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS :=         $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS :=        $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK :=      $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)

## include headers and libraries for Rcpp interface classes
RCPPINCL :=         $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --    slave)
RCPPLIBS :=         $(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## include headers and libraries for RInside embedding classes
RINSIDEINCL :=      $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS :=      $(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## compiler etc settings used in default make rules
CXX :=          $(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS :=         -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS :=         $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell     $(R_HOME)/bin/R     CMD config CXXFLAGS)
LDFLAGS =       -s
LDLIBS :=       $(RLDFLAGS) $(RBLAS) $(RLAPACK) $(RINSIDELIBS) $(RCPPLIBS) 
CC :=           $(shell $(R_HOME)/bin/R CMD config CXX)

all :           $(programs)

clean:
        rm -vf $(programs)

with the command

make -f Makefile.win

to try an build the standard examples included

However, I get the following error:

C:RInside_0.2.3RInsideexamplesstandard>make -f Makefile.win
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
cygdrive/c/R/R-2.12.2/bin/R: not found
cygdrive/c/R/R-2.12.2/bin/R: not found
cygdrive/c/R/R-2.12.2/bin/R: not found
cygdrive/c/R/R-2.12.2/bin/R: not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
make: cygdrive/c/R/R-2.12.2/bin/R: Command not found
Wall  -s  rinside_callbacks0.cpp        -o rinside_callbacks0
make: Wall: Command not found
make: [rinside_callbacks0] Error 127 (ignored)
Wall  -s  rinside_module_sample0.cpp        -o rinside_module_sample0
make: Wall: Command not found
make: [rinside_module_sample0] Error 127 (ignored)
Wall  -s  rinside_sample0.cpp        -o rinside_sample0
make: Wall: Command not found
make: [rinside_sample0] Error 127 (ignored)
Wall  -s  rinside_sample1.cpp        -o rinside_sample1
make: Wall: Command not found
make: [rinside_sample1] Error 127 (ignored)
Wall  -s  rinside_sample2.cpp        -o rinside_sample2
make: Wall: Command not found
make: [rinside_sample2] Error 127 (ignored)
Wall  -s  rinside_sample3.cpp        -o rinside_sample3
make: Wall: Command not found
make: [rinside_sample3] Error 127 (ignored)
Wall  -s  rinside_sample4.cpp        -o rinside_sample4
make: Wall: Command not found
make: [rinside_sample4] Error 127 (ignored)
Wall  -s  rinside_sample5.cpp        -o rinside_sample5
make: Wall: Command not found
make: [rinside_sample5] Error 127 (ignored)
Wall  -s  rinside_sample6.cpp        -o rinside_sample6
make: Wall: Command not found
make: [rinside_sample6] Error 127 (ignored)
Wall  -s  rinside_sample7.cpp        -o rinside_sample7
make: Wall: Command not found
make: [rinside_sample7] Error 127 (ignored)
Wall  -s  rinside_sample8.cpp        -o rinside_sample8
make: Wall: Command not found
make: [rinside_sample8] Error 127 (ignored)
Wall  -s  rinside_sample9.cpp        -o rinside_sample9
make: Wall: Command not found
make: [rinside_sample9] Error 127 (ignored)
Wall  -s  rinside_test0.cpp        -o rinside_test0
make: Wall: Command not found
make: [rinside_test0] Error 127 (ignored)
Wall  -s  rinside_test1.cpp        -o rinside_test1
make: Wall: Command not found
make: [rinside_test1] Error 127 (ignored)

I have tried with different paths for R_HOME but I question my ability to having found the right one. I am new to makefiles, so the error output is not of much help.

Hope somebody has some valuable insight to share!

Thanks in advance,

Christian

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I have a similar setup at work, so I gave this a shot. I'm able to build the examples after I specify R_LIBS_SITE. Note that it must be a Windows path, not a Cygwin path!

export R_LIBS_SITE=c:/R/site-library

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...