[R-pkg-devel] Fortran compilation issues (errors/warnings) on Fedora clang/llvm

2023-12-11 Thread Koen Hufkens
Hi Everyone,

I'm a co-lead on the development of the {rsofun} package, a package to
model ecosystem processes.

https://github.com/geco-bern/rsofun

The package uses a FORTRAN code base which is giving us some compilation
and CRAN compliance problems. Our last submission was withdrawn with the
following errors on Fedora: "
error:
loc("/data/gannet/ripley/R/packages/incoming/rsofun.Rcheck/00_pkg_src/rsofun/src/interface_biosphere_biomee.mod.f90":105:62):
/data/gannet/ripley/Sources2/LLVM/17.0/llvm-project-17.0.3.src/flang/lib/Lower/ConvertType.cpp:392:
not yet implemented: derived type components with non default lower bounds
"

This seems to be resolved when setting the suggested compiler flags for
Fedora as: `-fc-prototypes-external`. However, this generates Warnings
throughout platforms, as setting these compiler flags in Makevars is
considered poor practice.

I'm wondering how to reconcile both demands, i.e. addressing the above
CLANG/LLVM issue, while not setting the compiler flags? Any guidance or
ideas on this would be appreciated.

Kind regards,
Koen

-- 
Koen Hufkens, Ph.D.

Senior Scientist
Geocomputation and Earth Observation
Institute of Geography
University of Bern

founder BlueGreen Labs
bluegreenlabs.org
@koen_hufkens@mastodon.social

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] Fortran compilation issues (errors/warnings) on Fedora clang/llvm

2023-12-11 Thread Ivan Krylov
В Mon, 11 Dec 2023 10:02:14 +
Koen Hufkens  пишет:

> error:
> loc("/data/gannet/ripley/R/packages/incoming/rsofun.Rcheck/00_pkg_src/rsofun/src/interface_biosphere_biomee.mod.f90":105:62):
> /data/gannet/ripley/Sources2/LLVM/17.0/llvm-project-17.0.3.src/flang/lib/Lower/ConvertType.cpp:392:
> not yet implemented: derived type components with non default lower
> bounds

Experience shows that reporting bugs in flang-new may get them
acknowledged but not fixed [1]. Have you tried detecting the flang-new
compiler from the ./configure script and only adding the workaround
flag if the compiler matches? Something like the following:

#!/bin/sh
# taken from Writing R Extensions, 1.2. Configure and cleanup
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
  echo "could not determine R_HOME"
  exit 1
fi
# determine the Fortran 9x compiler
FC="`"${R_HOME}/bin/R" CMD config FC`"
# Use --version output to determine the compiler
# A different compiler will either accept --version and print something
# else or fail due to "unknown argument". In both cases the branch will
# not be taken
if "$FC" --version 2>/dev/null | grep -q 'flang-new version 17'; then
 echo "PKG_FCFLAGS = `"${R_HOME}/bin/R" CMD config FCFLAGS`" \
  " -fc-prototypes-external" >>src/Makevars
fi

You will still get an "unsupported flag" warning on machines with
flang-new, but at least it won't warn with standards-compliant
compilers or crash with flang-new. Unfortunately, I don't know whether
this is acceptable for CRAN, sorry.

Good luck!

-- 
Best regards,
Ivan

[1] https://stat.ethz.ch/pipermail/r-package-devel/2023q4/009987.html

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


[R-pkg-devel] vignette with "Run Examples"

2023-12-11 Thread Sigbert Klinke

Hi,

is it possible to get a button or link to run an example in a vignette 
like we see for the examples in the R help?


Thanks Sigbert

--
https://hu.berlin/sk
https://www.stat.de/faqs
https://hu.berlin/mmstat
https://hu.berlin/mmstat-ar

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


Re: [R-pkg-devel] vignette with "Run Examples"

2023-12-11 Thread Deepayan Sarkar
On Tue, 12 Dec 2023 at 12:54, Sigbert Klinke 
wrote:

> Hi,
>
> is it possible to get a button or link to run an example in a vignette
> like we see for the examples in the R help?
>

Just to understand your expectations: The 'run examples' option only works
within the "dynamic" R help system, because it has access to a running
version of R. Vignettes can also be viewed through the dynamic system, but
they perhaps more useful as standalone documentation (say on the CRAN page
of a package). Would it be really useful to be able to run the code only in
the limited setup of dynamic help?

The other issue is that examples are expected to be short and simple,
whereas vignettes can often be more complicated. They will also typically
include the "output" from running the code, so what would be the point of
running it again?

If you want to really try the vignette code, then the package documentation
page typically includes the R code extracted from a vignette, which you can
download and run. And of course with IDEs like ESS or RStudio, you can
simply open the vignette source and run the code interactively.

Best,
-Deepayan


>
> Thanks Sigbert
>
> --
> https://hu.berlin/sk
> https://www.stat.de/faqs
> https://hu.berlin/mmstat
> https://hu.berlin/mmstat-ar
>
> __
> R-package-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

[[alternative HTML version deleted]]

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel