Package Build Check fail due to Fortran Makevars dependencies

I am trying to compile some Fortran code with a C wrapper inside an R package, using this approach:

I am having trouble with the module dependencies. Here is my Makevars.

PKG_FCFLAGS += -x f95-cpp-input -fdefault-real-8 

C_OBJS = topnetc.o
FT_OBJS = nrtype.o empdis.o model_time.o simul_info.o basinparams.o basin_flux.o soilxs_bas.o topnetf.o

all: $(SHLIB) clean


empdis.o: nrtype.o
basin_flux.o model_time.o simul_info.o: nrtype.o
basinparams.o: empdis.o 
soilxs_bas.o: model_time.o basinparams.o basin_flux.o simul_info.o 
topnetf.o: soilxs_bas.o 
topnetmodule.mod: topnetf.o
topnetc.o: topnetmodule.mod

      rm -rf *.mod *.o

The RStudio Check is compiling nrtype and basin_flux successfully but then trying to compile basinparams, which needs empdis.

* installing *source* package 'TOPNET' ...
** using staged installation
** libs

*** arch - i386
C:/Rtools/mingw_32/bin/gfortran   -x f95-cpp-input -fdefault-real-8    -O3  -mtune=core2 -c  nrtype.f90 -o nrtype.o
C:/Rtools/mingw_32/bin/gfortran   -x f95-cpp-input -fdefault-real-8    -O3  -mtune=core2 -c  basin_flux.f90 -o basin_flux.o
C:/Rtools/mingw_32/bin/gfortran   -x f95-cpp-input -fdefault-real-8    -O3  -mtune=core2 -c  basinparam.f90 -o basinparam.o

USE empdis                                         ! empirical probability distribution structure (PRBDIS)
Fatal Error: Can't open module file 'empdis.mod' for reading at (1): No such file or directory
make: *** [C:/Users/WOODWA~1/DOCUME~1/R/R-36~1.3/etc/i386/Makeconf:236: basinparam.o] Error 1
ERROR: compilation failed for package 'TOPNET'

Do you know how I fix this?


Edit: It only seems to fail in Check, the package actually does Build. I think this is a bug in RStudio/R package checker.

This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.