RcppCore / RcppArmadillo

Rcpp integration for the Armadillo templated linear algebra library
193 stars 55 forks source link

Armadillo 14.0.0 std::cerr regression #446

Closed eddelbuettel closed 4 months ago

eddelbuettel commented 4 months ago

@conradsnicta I am hearing from @kurthornik that the current CRAN version of package hgwrr exhibits

* checking compiled code ... NOTE
File ‘hgwrr/libs/hgwrr.so’:
  Found ‘_ZSt4cerr’, possibly from ‘std::cerr’ (C++)
    Object: ‘hlmgwr.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 nor [v]sprintf.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.
* checking examples ... OK

whereas the previous version did not. I can confirm this -- my testing shows this too (but I do not promote such NOTEs to ERRORs so I do not see them all among the 1100+ packages to test). Any idea where this may have regressed because we otherwise have this scheme of dropping in R's output and error streams? A quick grep on my end did not lead me to anything.

(I am aware you now have 14.0.1 out as well but have not caught up; fighting with / working on two other CRAN submissions right now.)

kurthornik commented 4 months ago

conradsnicta writes:

Thanks, so I'll publish RcppArmadillo.

Best -k

@eddelbuettel @kurthornik This is a bug in the hgwrr package. This is not a regression in Armadillo or RcppArmadillo.

The hgwrr package erroneously includes the header instead of `' in several places:

is a wrapper around , and configures armadillo internals for compatibility with the R environment. By not including , the hgwrr package ends up using an "unconfigured" instance of armadillo. This leads to problems like the use of std::cerr. Additionally, the hgwrr package defines ARMA_NO_DEBUG, which was always risky and ill-advised. Newer versions of Armadillo ignore the old ARMA_NO_DEBUG macro. * https://github.com/cran/hgwrr/blob/9bd6adfe297134fa32b05306f6eed7d150a6da7c/src/Makevars.in#L17 TLDR: the authors of the hgwrr package made two separate mistakes. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.*Message ID:
eddelbuettel commented 4 months ago

Agreed. When I try a simple test of injecting RcppArmadillo.h instead, it builds during the check, does not seem to exhibit the cerr note ... but also segfaults in an example.

Upstream seems to be hard at work for a new 0.4.0 release so maybe we can talk to @HPDell and suggest this code change towards 'normal' RcppArmadillo header includes (which can still combine with using sub-modules or components using only Armadillo headers) but we do need RcppArmadillo on the R-interface parts.

And while I type this we hear from @kurthornik -- so moving on. @HPDell let us know if we can help.

Closing this at it is not an RcppArmadillo issue.

eddelbuettel commented 4 months ago

For completeness: a new version of hgwrr is now on CRAN so this is issue appears solved.