[R-pkg-devel] How to handle CRAN warning regarding stdout/stderr coming from code in upstream C library
Balasubramanian Narasimhan
n@r@@ @end|ng |rom @t@n|ord@edu
Mon Jun 2 18:16:19 CEST 2025
"Github" -> "Git"
-N
On 6/2/25 9:15 AM, Balasubramanian Narasimhan wrote:
> While on the subject, one useful workflow I have adopted (e.g. package
> cubature) is to clone the underlying C library to a Github repo.
> (Always happy to hear of others!)
>
> Then create a branch called `R_pkg` and make changes on this branch
> and use it as the source for your C library. Not only does it account
> for your changes, but also helps you keep abreast of future
> modifications to the original.
>
> In fact, the problems you mention are exactly what I had to deal with
> recently.
>
> -Naras
>
> On 5/31/25 4:15 PM, SN248 wrote:
>> Dear R package developers
>>
>> I am getting the following errors in my package (sundialr -
>> https://github.com/sn248/sundialr) which is a wrapper around SUNDIALS C
>> library. The warnings are as follows:
>>
>> ❯ checking compiled code ...
>>> WARNING File ‘sundialr/libs/sundialr.so’:
>>> Found ‘abort’, possibly from ‘abort’ (C) Object:
>>> ‘../inst/lib/libsundials_core.a’
>>> Found ‘puts’, possibly from ‘printf’ (C), ‘puts’ (C) Object:
>>> ‘../inst/lib/libsundials_core.a’
>>> Found ‘stderr’, possibly from ‘stderr’ (C) Object:
>>> ‘../inst/lib/libsundials_core.a’
>>> Found ‘stdout’, possibly from ‘stdout’ (C) Objects:
>>> ‘../inst/lib/libsundials_core.a’, ‘../inst/lib/libsundials_cvodes.a’,
>>> ‘../inst/lib/libsundials_idas.a’,
>>> ‘../inst/lib/libsundials_nvecserial.a’
>>> Compiled code should not call entry points which might terminate R nor
>>> write to stdout/stderr instead of to the console, nor use Fortran
>>> I/O nor
>>> system RNGs nor [v]sprintf. See ‘Writing portable packages’ in the
>>> ‘Writing
>>> R Extensions’ manual.
>>
>> See them at -
>> https://cran-archive.r-project.org/web/checks/2025/2025-05-12_check_results_sundialr.html
>>
>>
>> As far as I understand these warnings are coming from the following
>> files:
>>
>> 1. 'abort' coming from -
>> https://github.com/sn248/sundialr/blob/ace6865ac0bc995190bc4c354a8823ea8d3bd358/src/sundials/sundials/sundials_errors.c#L87
>>
>>
>> 2. I cannot find the file/line where 'puts' is coming from
>>
>> 3. stderr/stdout -- too many instances in SUNDIALS C code to list here,
>> e.g.,
>> https://github.com/sn248/sundialr/blob/ace6865ac0bc995190bc4c354a8823ea8d3bd358/src/sundials/arkode/arkode.c#L1285
>>
>>
>> In principle, I don't want to change anything in the upstream C library
>> code while including it in my package. Is this any other way to resolve
>> these warnings as the package has been archived because of these
>> warnings
>> now.
>>
>> Thanks
>> Satya
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-package-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
More information about the R-package-devel
mailing list