[Rd] -lgsl -lgslcblas fatal error no such file or directory

From: kevinpw <p.kevin.white_at_gmail.com>
Date: Sat, 09 Jun 2012 14:18:08 -0700 (PDT)


Hello,

Novice programmer.

I'm writing C source code and compiling it in as *.dll in the terminal by R CMD SHLIB foo.c. It works, I'm on a 64 bits windows system. I have the lastest R 2.15.0 and Rtools using the gcc 4.6.3 compiler.

However, that was a hello world run, and I installed GSL for the 64 bit system for fast MCMC. The Rcpp package was easy to use, but I opted for a C with GSL fashion because a MCMC simulation I'm attempting would have been astronomically time consuming with the JAGS Sampler. A couple webpages suggested the C/GSL might be optimal.

My issue is that even though the R CMD SHLIB *c built the *dll for simple examples, when I installed GSL for the (64 bit system), the R CMD -lgsl -lgslcblas *c returns a fatal error: gsl/gsl_rng.h no such file or directory exists. My paths are:

Does the order matter? I think Rtools needed to go first (in their order) in the path list.

PATH =
c:\R\Rtools\bin;c:\R\Rtools\gcc-4.6.3\bin;C:/R/R-2.15.0/bin/x64;C:\Program Files (x86)\MiKTeX 2.8\miktex\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows
Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\SAS\SharedFiles(32)\Formats;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files
(x86)\QuickTime\QTSystem\;C:\R\batchfiles_0.6-6;C:/R/GSL_test2/bin

I also created two new variables in the system environmental variables list GSL_LIB, value c:/R/GSL_test2/lib/
GSL_INC, value c:/R/GSL_test2/inc/

The source C code is

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <R.h>

void gibbsGSL(int *Np,int *thinp,int *seedp,double *xvec,double *yvec) {

    int i,j;
    int N=*Np,thin=*thinp,seed=*seedp;
    gsl_rng *r = gsl_rng_alloc(gsl_rng_mt19937);     gsl_rng_set(r,seed);
    double x=0;
    double y=0;
    for (i=0;i<N;i++) {

        for (j=0;j<thin;j++) {
            x=gsl_ran_gamma(r,3.0,1.0/(y*y+4));
            y=1.0/(x+1)+gsl_ran_gaussian(r,1.0/sqrt(2*x+2));
        }
        xvec[i]=x; yvec[i]=y;

    }
}

Any advice would be appreciated.

--
View this message in context: http://r.789695.n4.nabble.com/lgsl-lgslcblas-fatal-error-no-such-file-or-directory-tp4632908.html
Sent from the R devel mailing list archive at Nabble.com.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Sat 09 Jun 2012 - 21:32:13 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 10 Jun 2012 - 03:42:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive