[R-pkg-devel] How ton print in the console from Rcpp

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Oct 20 13:46:44 CEST 2022


В Thu, 20 Oct 2022 12:43:30 +0200
Elysée Aristide <ariel92and using gmail.com> пишет:

> What I understood is that it is better to use Rcpp functions. So I
> used:
> 
> Rcpp::Rcout << "beta: \n";
> Rcpp::print(betacpp);
> Rcpp::Rcout << "log-likelihood: " << llh << "\n";

This seems to be a right way of printing from Rcpp code.

> checking compiled code ... WARNING
> File ‘CDatanet/libs/CDatanet.so’:
>   Found ‘___assert_rtn’, possibly from ‘assert’ (C)
>     Objects: ‘CDincomInfo.o’, ‘CDincomInfo.rho.o’, ‘Homophily.o’,
>       ‘RcppExports.o’, ‘SARTIncomplet.o’

Since you don't call assert() yourself (which, in theory, shouldn't
matter as R packages are compiled with #define NDEBUG), it must be one
of the C++ template classes you're using. They may contain calls to
assert() or an equivalent, which get inlined inside your binary during
compilation. It might be even inside the implementation of the C++
standard library, which would be completely outside your control.

I'm not sure, but it could be possible to explain this situation to
CRAN as a false-positive. In order to find out further, you'll need
someone with a macOS computer or experience in cross-platform
development to either disassemble the existing binary or take the
compilation pipeline apart in order to find out where the calls to
___assert_rtn originate.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list