[R-pkg-devel] Makevars.win cppflags

Dirk Eddelbuettel edd at debian.org
Wed Mar 15 15:18:33 CET 2017


On 15 March 2017 at 08:54, Charles Determan wrote:
| I am working on an R package that contains some CUDA code.  As such, it
| needs to use the 'nvcc' compiler.  I then need to use some of the R header
| files such as R.h.  On a linux machine, I can handle this with my configure
| script using autotools that will replace @R_INCL@ with AC_SUBST(R_INCL).
| However, AFAIK, I cannot do this on a Windows machine.  I am trying to

You can use configure.win ... which may be a R script. See eg

    https://github.com/x13org/x13binary/blob/master/configure.win

where we simply copy exterior resources in. (Long story having to do with the
US Census bureau shipping a binary of something someone would these years or
decades construct as a library but I digress...)

In essence you have another layer of control and code _before_ you get
src/Makevars.win. 

| write the Makevars.win file to create the appropriate variables that I can
| pass to the nvcc compiler.  Here is an excerpt:
| 
| R_INCL=`$(shell ${R_HOME}/bin/R CMD config --cppflags)`
| 
| CU_INCL = -I../inst/include $(R_INCL)
| 
| %.o: %.cu $(cu_sources)
| $(NVCC) $(CU_ARCH) $(CU_ARGS) $(CU_INCL) $< -c
| 
| 
| However, I keep getting a truncated output from the --cppflags output.  If
| I run from the commandline R CMD config --cppflags I get:
| 
| -IC:/Users/cdeterman/Documents/R/R-3.3.2/include
| -IC:/Users/cdeterman/Documents/R/R-3.3.2/include/x64
| 
| but when run in the build/install I get
| 
| -IC:/Users/CDETER~1/DOCUME~1/R/R-33~1.2/include
| -IC:/Users/CDETER~1/DOCUME~1/R/R-33~1.2/include/x64
| 
| and the compliation fails saying that the
| -IC:/Users/CDETER~1/DOCUME~1/R/R-33~1.2/include is not found whereas the
| full path is found.
| 
| Any assistance is appreciated.

I am no expert on the various braindeadednesses of that platform but these
two paths should be equivalent. If they are not something else may go on, but
you can also try to invoke a tool to 'expand' the shortened path.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



More information about the R-package-devel mailing list