Hi, I am working on a UNIX machine and I am interfacing R and C with the .C function. I am trying to call LAPACK and BLAS routines, but am running into a problem where, while I am able to run the BLAS routines, I cannot run the LAPACK routines.
I compile my .c file (at end of email) in the following way: [mhitc...@jlogin2 ~/Cstuff]$ R CMD SHLIB testmore.c gcc -std=gnu99 -I/home/mhitczen/R-2.9.0/include -I/usr/local/include -fpic -g -O2 -c testmore.c -o testmore.o gcc -std=gnu99 -shared -L/usr/local/lib -o testmore.so testmore.o However, I get the following error in R: > dyn.load("testmore.so") Error in dyn.load("testmore.so") : unable to load shared library '/home/mhitczen/Cstuff/testmore.so': /home/mhitczen/Cstuff/testmore.so: undefined symbol: dpotrf_ This error goes away and everything works when I simply call the BLAS routine (In the testmore.c file I simply remove funct2, leaving funct which calls the routine "dgemm" found in the BLAS.h file). I read the "Writing R Extensions" and created a file: /R-2.9.0/src/Makevars that contains the line: PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) What am I doing wrong? Thanks for your time and effort. My testmore.c file is: #include <Rinternals.h> #include <Rmath.h> #include <R.h> #include <R_ext/Applic.h> #include <R_ext/Lapack.h> #include <R_ext/BLAS.h> #include <R_ext/RS.h> // FUNCTION CALLING BLAS void funct(double *x, int *dim, double *y, double *result){ double one=1.0; double zero =0.0; char *transa="N"; char *transb="N"; F77_CALL(dgemm) (transa,transb,dim,dim,dim,&one,x,dim,y,dim,&zero,result,dim); } // FUNCTION CALLING LAPACK void funct4(double *x, int *dim, double *result){ char *UorL="L"; int info=0; F77_CALL(dpotrf)(UorL,dim,x,dim, &info); } Best, Marcin Hitczenko ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel