[R-pkg-devel] Compiling with more than one compiler in package development
Hello!
I'm not sure if this appeared, so I thought I would try again. I am
building a package on a RedHat supercomputer, using the gcc/gfortran and
the accompanying mpi (MPICH) compilers. Here is the Makefile:
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
all: rmpigFortr.so tria.so
rmpigFortr.so:
mpifort -fPIC -c rmpigFortr.f90 -o rmpigFortr.o
mpifort -shared rmpigFortr.o -o rmpigFortr.so
tria.so:
gfortran -m64 -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexcep\
tions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches \
-m64 -mtune=generic -c tria.f90 -o tria.o
gfortran -m64 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o tria.so
tria.o\
-L/usr/lib64/R/lib -lR
Here is the NAMESPACE:
# Generated by roxygen2: fake comment so roxygen2 overwrites silently.
exportPattern("^[^\\.]")
useDynLib(rmpigFortr)
useDynLib(tria)
When I build, check, and install the package, it seems to be fine.
However, I have an R function that calls that "tria" Fortran subroutine.
Here are the results:
library(rmpigFortr)
za <- tri(n=1000)
Error in .Fortran("tria", as.single(y), as.integer(n)) :
"tria" not resolved from current namespace (rmpigFortr)
But if I type in the call to .Fortran myself, it works. Any idea what I might be doing wrong, please? Thanks in advance, Sincerely, Erin
Erin Hodgess Associate Professor Department of Mathematical and Statistics University of Houston - Downtown mailto: erinm.hodgess at gmail.com [[alternative HTML version deleted]]