I've inherited some F77 code from the 1980s that I'd like to eventually use in an R package that is on CRAN. Basically I'll be substituting a slow function written in straight R with a .Call to a F77 subroutine that runs 100x faster. I've done similar heavy lifting with C in the past. However, when I compile the fortran subroutine via R CMD SHLIB I get a warning about one of the arrays being "larger than limit set by '-fmax-stack-var-size='". I can fix this by compiling explicitly with gfortran and setting -fmax-stack-var-size appropriately. However, how can I set the flag when running R CMD SHLIB? In a Makevars file? Eventually, I'll include this in a new release and submit to CRAN and I want to head off any issues. Many thanks.
Compiling F77 with R CMD SHLIB for use in R package. Changing `-fmax-stack-var-size=`
158 views Asked by user111024 At
1
Yes, in
~/.R/Makevarsfor your compilations, insrc/Makevarsfor all builds of the package. CRAN has views on which options are portable so you may not be able to ship with the option insrc/Makevars.Here is what I have:
where some of the other values are previoysly set as you can surmise. Note that there are several Fortran compiler variables, details as usual in Writing R Extensions.