[R-pkg-devel] OpenMP & Fortran: Seemingly contradictory responses from CRAN

Avraham Adler @vr@h@m@@d|er @end|ng |rom gm@||@com
Sun Jan 27 18:28:33 CET 2019


Hello.

I am at my wits end as to how to comply with CRAN regarding my
Delaporte package which uses Fortran and OpenMP [1].

Recently, it was announced [2] that going forward, OpenMP should be
linked with SHLIB_OPENMP_CFLAGS.

Moreover, I received an email from Professor Ripley, stating:

-------START Prof. Ripley------
There are two issues

- Linking in R-devel is done by C or C++ even for F95 code, so PKG_LIBS
needs to contain the appropriate macro, SHLIB_OPENMP_CFLAGS for all
these packages.

- SHLIB_OPENMP_FFLAGS is preferred to SHLIB_OPENMP_FCFLAGS

There are two possibilities to correct this:

A) Make a version of the package depending on R(>=3.6.0) and submit
stating it is intended for the 3.6.0/Others area.

B) With both points changed the package should still work under R 3.5.x
as for current platforms SHLIB_OPENMP_FFLAGS, SHLIB_OPENMP_FCFLAGS and
SHLIB_OPENMP_CFLAGS have the same value.  So it could be submitted for
the main CRAN area.
-------STOP Prof. Riple------

My first attempt had the following Makevars submitted the to CRAN:

PKG_FFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)

Granted, this would not have had OpenMP for other reasons (FFLAGS will
only be recognized for free-form Fortran in R 3.6+) but the submission
was denied with the following note:

-----START CRAN-----

Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-ix86+x86_64
Check: use of SHLIB_OPENMP_*FLAGS in Makefiles, Result: NOTE
    src/Makevars: incorrect macro SHLIB_OPENMP_CFLAGS included in PKG_FFLAGS
    src/Makevars: SHLIB_OPENMP_CFLAGS is included in PKG_LIBS but not
in PKG_CFLAGS
-----STOP CRAN-----

Uwe Ligges was kind enough to clarify:

-----START Prof. Ligges-----
Sun, Jan 13, 12:16 PM (8 days ago)

to me, CRAN-submissions
Pls re-read Brian's comment and note that we already check with R-devel.
He daid:

" PKG_LIBS needs to contain the appropriate macro, SHLIB_OPENMP_CFLAGS "

but you have it in PKG_FFLAGS now?
(first) and then
" SHLIB_OPENMP_CFLAGS is included in PKG_LIBS but not in PKG_CFLAGS", si
please declare it there, too.
-----STOP Prof. Ligges-----

So, I declared CFLAGS too. However, When I passed (substituting
FCFLAGS so that OpenMP will work in R-release):

PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_FCFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)

I got:

-----START CRAN-----
Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-ix86+x86_64
Check: use of SHLIB_OPENMP_*FLAGS in Makefiles, Result: NOTE
    src/Makevars: incorrect macro SHLIB_OPENMP_CFLAGS included in PKG_FCFLAGS
-----STOP CRAN-----

If I give up and focus just on R-release by passing:

PKG_FCFLAGS = $(SHLIB_OPENMP_FCFLAGS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_FCFLAGS)

I get:

-----START CRAN-----
Flavor: r-devel-linux-x86_64-debian-gcc, r-devel-windows-ix86+x86_64
Check: use of SHLIB_OPENMP_*FLAGS in Makefiles, Result: NOTE
    src/Makevars: SHLIB_OPENMP_FFLAGS is preferred to
SHLIB_OPENMP_FCFLAGS in PKG_FCFLAGS
    src/Makevars: SHLIB_OPENMP_FCFLAGS is included in PKG_FCFLAGS but
not SHLIB_OPENMP_CFLAGS in PKG_LIBS
    src/Makevars: SHLIB_OPENMP_FCFLAGS is included in PKG_LIBS but
linking is by C
-----STOP CRAN-----

If I really give up and pass Depend: R <= 3.5.2 in the DESCRIPTION,
*noting in the comments that I will submit a new R 3.6+ only version
when it is released* I still get a failure:

-----START CRAN-----
Flavor: r-devel-windows-ix86+x86_64
Check: whether package can be installed, Result: ERROR
  Installation failed.
  See 'd:/RCompile/CRANincoming/R-devel/Delaporte.Rcheck/00install.out'
for details.

Flavor: r-devel-linux-x86_64-debian-gcc
Check: whether package can be installed, Result: ERROR
  Installation failed.
  See '/srv/hornik/tmp/CRAN/Delaporte.Rcheck/00install.out' for details

-----STOP CRAN-----

Which actually was the point, to be honest. It wasn't supposed to pass R-devel.

I cannot pass JUST:

PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)

AS OpenMP would not be compiled into the Fortran.

I really would like to have oe version of the package that is CRAN
compliant, but at this point, I cannot see how to do that based on the
various rejection messages I got. Maybe I'm missing something simple,
in which case, please explain. Any guidance would be much appreciated.

Thank you,

Avi

[1] https://cran.r-project.org/package=Delaporte
[2] https://developer.r-project.org/blosxom.cgi/R-devel/NEWS/2018/12/04#n2018-12-04



More information about the R-package-devel mailing list