[Rcpp-devel] Configuring GSL headers and library for RcppGSL use on windows

Dirk Eddelbuettel edd at debian.org
Thu Jul 5 21:58:39 CEST 2012

On 5 July 2012 at 19:42, Silkworth,David J. wrote:
| I have installed the GSL setup file " Complete package, except sources 	Setup	  6476814 	11 July 2006" from
| http://gnuwin32.sourceforge.net/packages/gsl.htm

Has that been built with MinGW so that you can use it with R?  Else you may
be wasting your time.  Matching compilers matter ...

| The Vignette says "We may need to find the location of the GSL headers and library, and this done easily from a configure source script which autoconf generates from a configure.in source file such as the following:"

That was written for the OS that typically uses configure, ie not Windows.

| I think this autoconf program relates specifically to a Linux environment.  Windows seems to know nothing of the sort.

| Then the Vignette continues with:
| "
| Similarly, the configure.win for windows can be written as:
| GSL_CFLAGS=`${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "RcppGSL:::CFlags()"`
| GSL_LIBS=`${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "RcppGSL:::LdFlags()"`
| RCPP_LDFLAGS=`${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe -e "Rcpp:::LdFlags()"`
| sed -e "s|@GSL_LIBS@|${GSL_LIBS}|" n
| -e "s|@GSL_CFLAGS@|${GSL_CFLAGS}|" n
| src/Makevars.in > src/Makevars.win
| "
| Now, honestly guys, I've mastered a number of tasks so that I can build and check Rcpp and RcppArmadillo packages on both Windows and Linux.  But I am now stumped with what to do with this configure.win file.  Some of us really need hand holding.  Sorry I had to ask.

You may want to ignore the Linux stuff which makes things work on Linux where
certain assumptions can be made.  On Windows, almost all bets are off.
RcppGSL itself uses this two-line Makevars.win:

   ## This assumes that the LIB_GSL variable points to working GSL libraries
   PKG_CPPFLAGS=-I$(LIB_GSL)/include -I../inst/include
   PKG_LIBS=-L$(LIB_GSL)/lib -lgsl -lgslcblas $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()")

which takes advantage of the fact that by "convention" (for lack of a better
term) CRAN and related hosts have copies of the GLS headers and libraries in
a directory pointed to by the LIB_GSL variable.

You could do the same, eg use a variable LIB_GSL.


Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list