Qiang,

Sorry for the late reply (somehow your reply ended up in the Junk folder). 
Switching RcppArmadillo and RcppEigen in the LinkingTo section (and thus the 
header order) did not help BUT your mention of NDEBUG lead me to this Githuhb 
issue: https://github.com/RcppCore/RcppArmadillo/issues/116. The addition of a 
similar file in the inst folder (see change log at the bottom of the issue) 
with #define NDEBUG 1 and then adding the file as an import in RcppExports.cpp 
did the trick. Unfortunately, running compileAttributes() locally overwrites 
the manual changes in RcppExports.cpp but, for now, I guess I will have to live 
with this. Thanks a lot for your input!

Kind Regards,
Jason




On 13 Jun 2018, at 15:51, Qiang Kou <q...@qkou.info<mailto:q...@qkou.info>> 
wrote:

Hi, Jason,

The assert is from RcppEigen.

I think the reason is how "NDEBUG" is handled by Armadillo.

In your package, the RcppArmadillo header is included before RcppEigen: 
https://github.com/jasonserviss/check/blob/master/src/RcppExports.cpp#L4<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cHM6Ly9naXRodWIuY29tL2phc29uc2Vydmlzcy9jaGVjay9ibG9iL21hc3Rlci9zcmMvUmNwcEV4cG9ydHMuY3BwI0w0&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=fdecf48f&_r=a2ktc2U%3D>

In RcppArmadillo:

https://github.com/RcppCore/RcppArmadillo/blob/master/inst/include/RcppArmadilloConfig.h#L92-L94<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cHM6Ly9naXRodWIuY29tL1JjcHBDb3JlL1JjcHBBcm1hZGlsbG8vYmxvYi9tYXN0ZXIvaW5zdC9pbmNsdWRlL1JjcHBBcm1hZGlsbG9Db25maWcuaCNMOTItTDk0&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=cf8cff17&_r=a2ktc2U%3D>

The NDEBUG has been undefined.

Then in RcppEigen:

https://github.com/RcppCore/RcppEigen/blob/master/inst/include/Eigen/src/Core/util/Macros.h#L549<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cHM6Ly9naXRodWIuY29tL1JjcHBDb3JlL1JjcHBFaWdlbi9ibG9iL21hc3Rlci9pbnN0L2luY2x1ZGUvRWlnZW4vc3JjL0NvcmUvdXRpbC9NYWNyb3MuaCNMNTQ5&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=4af01d3b&_r=a2ktc2U%3D>

The assert will be used if NDEBUG has been undefined.

I hope this answers your question.

Best wishes,

KK


On Wed, Jun 13, 2018 at 7:05 AM, Jason Serviss 
<jason.serv...@ki.se<mailto:jason.serv...@ki.se>> wrote:
Hello everyone,

I am currently in the process of trying to utilise C++ via Rcpp, RcppEigen, and 
RcppArmadillo in a package for the first time. I am experiencing the following 
on running devtools::check() with the package:


checking compiled code ... WARNING
File ‘check/libs/check.so’:
  Found ‘___assert_rtn’, possibly from ‘assert’ (C)
    Object: ‘RcppExports.o’


I found a similar problem previously discussed (here: 
http://rcpp-devel.r-forge.r-project.narkive.com/yc1h8bf6/rcppeigen-package-skeleton-r-cmd-check-warning<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cDovL3JjcHAtZGV2ZWwuci1mb3JnZS5yLXByb2plY3QubmFya2l2ZS5jb20veWMxaDhiZjYvcmNwcGVpZ2VuLXBhY2thZ2Utc2tlbGV0b24tci1jbWQtY2hlY2std2FybmluZw%3D%3D&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=f9d02bc5&_r=a2ktc2U%3D>)
 some time ago although, in this case, it seemed to be system specific. Based 
on the comments, I created a minimal reproducible example (here: 
https://github.com/jasonserviss/check<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cHM6Ly9naXRodWIuY29tL2phc29uc2Vydmlzcy9jaGVjaw%3D%3D&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=fd24f0d8&_r=a2ktc2U%3D>)
 and automated the build with TravisCI (build report here: 
https://travis-ci.org/jasonserviss/check/builds/391685256<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cHM6Ly90cmF2aXMtY2kub3JnL2phc29uc2Vydmlzcy9jaGVjay9idWlsZHMvMzkxNjg1MjU2&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=717fbb88&_r=a2ktc2U%3D>).

I have noticed two things:

1) there are 2 functions in the package, function “a" and function “b”, if I 
remove function “b” I no longer receive the warning. Despite this, there 
wouldn’t, to my eyes, seem to be anything extremely unusual about function “b”.

2) If I remove RcppArmadillo from the LinkingTo section in the DESCRIPTION file 
I, again, no longer receive the warning. I am aware of the fact that, in the 
example, there is no need to link to RcppArmadillo although, in the real use 
case, there is.

Id be very appreciative if anyone here could help me get an understanding for 
this warning and how it can be resolved!

Kind Regards,
Jason Serviss


_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org<mailto:Rcpp-devel@lists.r-forge.r-project.org>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel<https://mailfilter.sunet.se/canit/urlproxy.php?_q=aHR0cHM6Ly9saXN0cy5yLWZvcmdlLnItcHJvamVjdC5vcmcvY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3JjcHAtZGV2ZWw%3D&_s=amFzb24uc2Vydmlzc0BraS5zZQ%3D%3D&_c=07a68f11&_r=a2ktc2U%3D>


_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to