[Rcpp-devel] RcppArmadillo with R-devel

Dirk Eddelbuettel edd at debian.org
Thu Apr 26 18:34:56 CEST 2012

On 26 April 2012 at 12:06, Whit Armstrong wrote:
| Has anyone seen this subtle change between R 2.15 and R-devel for
| packages linking to RcppArmadillo?
| on R 2.15:
| warmstrong at krypton:~/dvl/R.packages/rcppbugs.Rcheck/rcppbugs/libs$ nm
| -C rcppbugs.so |grep assert
| warmstrong at krypton:~/dvl/R.packages/rcppbugs.Rcheck/rcppbugs/libs$
| on R-devel:
| nodeadmin at redbox:~/rcppbugs.Rcheck/rcppbugs/libs$ nm -C rcppbugs.so |grep assert
| 0000000000043f90 W arma::arma_assert_same_size(unsigned int, unsigned
| int, unsigned int, unsigned int, char const*)
|                  U __assert_fail@@GLIBC_2.2.5
| nodeadmin at redbox:~/rcppbugs.Rcheck/rcppbugs/libs$
| The __assert_fail is now a blocker for my package updates to CRAN.

Well I did tell you (off-list) about the change which I had sprinkled into
your rcppbugs code in order to suppress such a warning with R 2.15.0 on your
initial release 0.0.2:

edd at max:/tmp$ R CMD check rcppbugs_0.0.2.tar.gz
* using log directory ‘/tmp/rcppbugs.Rcheck’
* using R version 2.15.0 (2012-03-30)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* checking for file ‘rcppbugs/DESCRIPTION’ ... OK
* this is package ‘rcppbugs’ version ‘0.0.2’
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking compiled code ... NOTE
File ‘/tmp/rcppbugs.Rcheck/rcppbugs/libs/rcppbugs.so’:
  Found ‘__assert_fail’, possibly from ‘assert’ (C)
    Object: ‘interface.o’

Compiled code should not call functions which might terminate R nor write to stdout/stderr instead of to the console.

See ‘Writing portable packages’ in the ‘Writing R Extensions’ manual.

So as best as I can tell, not a R 2.15.0 vs R-devel change.

The warning above goes away when you do

edd at max:/tmp$ diff -u rcppbugs.orig/src/interface.cpp rcppbugs.patched/src/interface.cpp 
--- rcppbugs.orig/src/interface.cpp     2012-04-23 07:19:20.000000000 -0500
+++ rcppbugs.patched/src/interface.cpp  2012-04-26 11:27:29.402628097 -0500
@@ -22,6 +22,7 @@
 #include <boost/random.hpp>
 #include <Rcpp.h>
 #include <RcppArmadillo.h>
+#define NDEBUG 1
 //#include <cppbugs/cppbugs.hpp>
 #include <cppbugs/mcmc.deterministic.hpp>
 #include <cppbugs/mcmc.normal.hpp>
edd at max:/tmp$ 

As Romain pointed out to you in the past your use of _both_

   #include <Rcpp.h>
   #include <RcppArmadillo.h>

is not what we recommend or suggest.  Your code is a little special because
of your very own cppbugs and its added dependencies -- but that is your
choice, and I am afraid, it may be your issue to sort out. Or it may not be,
but I don't know yet of other packages bitten by 

  a) the imposed NDEBUG from R


  b) the #undef we added per Conrad's suggestion in RcppArmadillo
| This is exactly the same package build, just compiled on R-2.15 vs R-devel.
| I see that both R-2.15 and R-devel already set -DNDEBUG.
| Should I be setting ARMA_NO_DEBUG in addition?

Conrad recommends against this as you'd loose some valuable tests.   But do
what you have to do get onto CRAN ...  

I won't have time to check your github sources but the one-line change works
for me with R 2.15.0 and your first release.


| Source code is here for anyone who wants to try:
| https://github.com/armstrtw/rcppbugs/downloads
| -Whit
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

R/Finance 2012 Conference on May 11 and 12, 2012 at UIC in Chicago, IL
See agenda, registration details and more at http://www.RinFinance.com

More information about the Rcpp-devel mailing list