1

I am the package developer for o2plsda which is included in CRAN. I got an email saying that I need to fix the following warnings:

  File ‘o2plsda/libs/o2plsda.so’:
    Found ‘___assert_rtn’, possibly from ‘assert’ (C)
      Objects: ‘RcppExports.o’, ‘misc.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.

I am not sure why this happened. Please help me fix it.

AndrewGB
  • 16,126
  • 5
  • 18
  • 49
bioguo
  • 61
  • 4
  • 2
    Somewhere in your code, or in code you include with your code, is an `assert()`. You are asked to remove it, or to comment it out. Do you have a public `git` or `svn` repo? – Dirk Eddelbuettel Dec 19 '21 at 23:00
  • 1
    I found your version 0.0.12 on GitHub, but I cannot currently reproduce this on Linux. I do not get the warning. If you can reproduce what CRAN reports, please show us how. If you cannot reproduce, talk to CRAN and ask what they did. – Dirk Eddelbuettel Dec 19 '21 at 23:46
  • 1
    According to [the results page at CRAN](https://cran.r-project.org/web/checks/check_results_o2plsda.html) it only happens on macOS. I have no idea why. – Dirk Eddelbuettel Dec 20 '21 at 00:18
  • Yes. It only happens on macOS. I don't know how to fix it. I tried all the possibly methods I found online but it doesn't work. I got warnings from the Prof. Brian Ripley. And I am not sure why this happen. The github address for the package is: https://github.com/guokai8/o2plsda. Thanks a lot! – bioguo Dec 21 '21 at 14:50
  • I do not use a mac, nor do I have one. But many users of Rcpp do so I would suggest (first subscribing to the list so that you can post and then) post this on the rcpp-devel list where someone may be able to reproduce and help you. It may be caused from compilation option "somewhere" but RcppArmadillo use by over 900 other CRAN packages and this is the first time this came up so it is likely something at your end. – Dirk Eddelbuettel Dec 21 '21 at 15:20
  • Thanks a lot! Shall I directly close this one and post the question to rcpp-devel? I also found other case similar to mine, such as https://lists.r-forge.r-project.org/pipermail/rcpp-devel/2018-June/010033.html and https://github.com/airoldilab/sgd/issues/44. I tried the answer they had but it didn't work. – bioguo Dec 21 '21 at 16:57
  • I would not yet worry about closing this as the issue isn't fixed. – Dirk Eddelbuettel Dec 21 '21 at 17:00
  • The first link you post about `NDEBUG` could matter. I noticed that your [src/Makevars](https://github.com/guokai8/o2plsda/blob/main/src/Makevars) isn't quite right: line 14 overwrites the assignment in line 13. You could try combining them and/to ensure `NDEBUG` is not set, see [this link](https://en.cppreference.com/w/c/error/assert). Then again, I think R already define `NDEBUG` ... – Dirk Eddelbuettel Dec 21 '21 at 17:04
  • Thanks! I will try this one. Thanks again! – bioguo Dec 21 '21 at 17:54
  • 1
    I rewrite some code and totally remove the RcppEigen part and now it works with no warnings on macOS! I think there are something conflicts between RcppArmadillo and RcppEigen. And maybe something related the NDEBUG. Thanks again! @DirkEddelbuettel – bioguo Dec 22 '21 at 18:34
  • I had missed you included both. I think there can possibly be a side effect in inclusion order; which may go away with `-DNDEBUG`. Anyway, you're set and that counts. – Dirk Eddelbuettel Dec 22 '21 at 18:37
  • Yes. I saw others had almost same issues and they said you could change the order. I tried but it may be still something wrong there. Now I just use the RcppArmadillo since I need it. I will continue to work on my package and to see if I can find another solution. Thanks! @DirkEddelbuettel – bioguo Dec 22 '21 at 18:49
  • 2
    In case it still matters, my solution was to add a header file into the `/inst/include` directory with the following lines `#include ` `#define NDEBUG` `#include ` I'm not sure whether this is recommended, though. – baruuum Feb 22 '22 at 09:41
  • 1
    Thanks @baruuum. I had a similar issue and your solution worked. – Stéphane Laurent Mar 06 '22 at 13:06
  • Hi @baruuum and @Stéphane Laruent, I am facing a similar problem (`___assert_rtn` error for mac in a package that builds on both armadillo and eigen). Can you maybe link to a repo with code that "works"? Here's the [package repo](https://github.com/s3alfisc/fwildclusterboot) where the error occurs, in case you should have time to take a look! – A.Fischer Apr 03 '22 at 19:38
  • I have managed to fix it as well by including the header file - here is a link to the repo: https://github.com/s3alfisc/fwildclusterboot/blob/master/inst/include/fwildclusterboot.h – A.Fischer Apr 04 '22 at 19:25

0 Answers0