Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use system2 instead of system #12

Merged
merged 13 commits into from
Sep 3, 2020
Merged

Conversation

bgoodri
Copy link
Contributor

@bgoodri bgoodri commented Sep 3, 2020

084dbdd is the the commit that actually changes to using the more portable system2 rather than the older system, which fixes #11. The rest of the commits were just me flailing around trying to get the error / verbosity reporting to be reasonable in more situations. You might have a different definition of reasonable, but I think the main two things were:

  • Show what make would do by calling R CMD SHLIB with --dry-run if verbose = TRUE or if there was an error
  • Show the end of the error message if it is too long to be printed in its entirety. R has an option() for this, but by default it is 10000 lines I think. Unfortunately, it is pretty common to have more than 10000 lines of unhelpful compiler warnings if using headers from BH or especially RcppEigen. So, if you feed the whole error file into stop, it would only show the first 10000 compiler warnings rather than the text of the actual compiler error. Now, it is feeding tail(errmsg) to stop when it exceeds the line limit, so you at least see the compiler error rather than the compiler warnings.

I ran revdepcheck::revdep_check under r-devel on Debian. mkin, RxODE, and themetagenomics have errors with inline on CRAN that are still errors with this PR but nothing got worse. I also ran it on Windows and didn't encounter any additional problems other than a couple packages were too complicated to install from source. Someone else ran it on Mac and said there were no additional problems. Other people have been installing my branch from GitHub and using it with RStan, so I think it is solid.

The system2 function has an env argument that you might want to use to set the environmental variables rather than setting them in cxxfunction, but I didn't touch that.

if someone wants to see the compiler call, they can do that by specifying verbose = TRUE
The errfile/msg contains compiler warnings, which will often be many, long, and non-useful if the code uses Boost, Eigen, etc. But R truncates the message at 1000 characters by default starting from the begining, which shows the first few compiler warnings and not the actual error message at the end. So, it is better to show the last few lines than the first few lines.
since errmsg is a character vector of multiple lines
because there is already a on.exit(setwd(wd))
facilitate showing what make would do via --dry-run

do not setwd() because it is already in an on.exit()

account for the limits on printing the error message, which may be
thousands of lines long due to compiler warnings from Eigen / Boost
DESCRIPTION Outdated
Version: 0.3.15
Date: 2018-05-18
Version: 0.3.16
Date: 2020-07-11
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert that to (at the most) 0.3.15.1 and current date.

Setting releases is what Maintainer: does.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also rebasing/squashing may be a good idea though I can do that too when I merge.

@eddelbuettel eddelbuettel merged commit 50173d3 into eddelbuettel:master Sep 3, 2020
@eddelbuettel
Copy link
Owner

Thanks, squashed. Having system2() is good. It probably didn't exist yet when inline was written.

@eddelbuettel
Copy link
Owner

Thanks again -- now on CRAN.

@bgoodri
Copy link
Contributor Author

bgoodri commented Sep 6, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cxxfunction (really compileCode) drops PKG_LIBS on Windows
2 participants