[Rcpp-devel] Something strange with the package check and calls to C abort

Juan Domingo Esteve Juan.Domingo at uv.es
Sat Oct 29 20:41:11 CEST 2022


Dear all:

  I am new to this list and I am using Rcpp for my first large and serious package, so
I apologize if probably this is a naive question, but I have browsed the web and looked
at the stored mail messages of this list from the beginning of this year without finding
an answer.

  My package passed the checks and I was about to try uploading to CRAN but this morning
I have updated all R packages (including Rcpp and devtools) and now the package fails the
check because of two warnings. These are

Found ‘abort’, possibly from ‘abort’ (C)
       Objects: ‘RcppExports.o’, ‘fullmatrix.o’, ‘jmatrix.o’,
         ‘matgetcols.o’, ‘matgetdiag.o’, ‘matgetrows.o’, ‘matmetadata.o’,
         ‘matwrite.o’, ‘memhelper.o’, ‘sparsematrix.o’,
         ‘symmetricmatrix.o’, ‘teststop.o’
     Found ‘printf’, possibly from ‘printf’ (C)
       Objects: ‘RcppExports.o’, ‘fullmatrix.o’, ‘jmatrix.o’,
         ‘matgetcols.o’, ‘matgetdiag.o’, ‘matgetrows.o’, ‘matmetadata.o’,
         ‘matwrite.o’, ‘memhelper.o’, ‘sparsematrix.o’,
         ‘symmetricmatrix.o’, ‘teststop.o’

I don't call abort, exit or any similar C library function and all my
interaction are through Rcpp::Rcout, Rcpp::Rcerr, Rcpp::warning and
Rcpp::stop.

After some checks, I have found that this happens when I use
Rcpp::warning and Rcpp::stop. Indeed, with a code like this in testtstop.cpp

#include <Rcpp.h>

void test()
{
  Rcpp::Rcout << "This is the standard output\n";
  Rcpp::Rcerr << "This is the standard error\n";
  Rcpp::warning("This is a warning\n");
  Rcpp::stop("This should stop the program.\n");
  return;
}

the object teststop.o disappears from the list of those which annoy
devtools:check when I comment the lines with Rcpp::warning and Rcpp::stop.

As a last resort, I have tried to download the sources of the Rcpp
package itself and compile/check in the same way, to convince myself
that the failure might be there. And indeed, I have got this:

W  checking compiled code ...
    File ‘Rcpp/libs/Rcpp.so’:
      Found ‘abort’, possibly from ‘abort’ (C)
        Objects: ‘attributes.o’, ‘module.o’
      Found ‘printf’, possibly from ‘printf’ (C)
        Objects: ‘attributes.o’, ‘module.o’

    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.

An abort function is effectively called from file inst/include/Rcpp/r_cast.h
at lines 75 and 129.

Might this be the cause of the check failure?

I know that this seems more a problem from devtools:check than from Rcpp, but
it is much more likely that I am totally misunderstanding the question, since
this would prevent any package done with Rcpp to be uploaded to CRAN and many
people would have already noticed.

  So again, I reiterate my apologies and if you are so kind to point me to
appropriate documentation to solve the issue, I would be very grateful.

  Sincerely

   Juan
-- 
________________________________________________________________
Juan Domingo Esteve
Dept. of Informatics, School of Engineering
University of Valencia
Avda. de la Universidad, s/n.
         46100-Burjasot (Valencia)
            SPAIN

Telephone:      +34-963543572
Fax:            +34-963543550
email:  Juan.Domingo at uv.es
________________________________________________________________


More information about the Rcpp-devel mailing list