On Fri, 4 Sep 2009, Marcin Hitczenko wrote:
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)
That is not where it tells you to put the file. It needs to be in the
direcctory where you run the compile (normally the 'src' directory of
a package), and in your case that seems to be ~/Cstuff.
That BLAS works is fortuitous, depending on the way you built R.
[...]
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel