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

Compile R with debugging flags #4

Closed
wch opened this issue May 9, 2018 · 3 comments
Closed

Compile R with debugging flags #4

wch opened this issue May 9, 2018 · 3 comments

Comments

@wch
Copy link
Owner

wch commented May 9, 2018

Consider compiling all builds with _GLIBCXX_ASSERTIONS and possibly _GLIBCXX_DEBUG. This will help catch some C++ errors earlier on. (For example, rstudio/httpuv#133.)

https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html

Note that _GLIBCXX_DEBUG, the documentation says, "this flag changes the sizes and behavior of standard class templates such as std::vector, and therefore you can only link code compiled with debug mode and code compiled without debug mode if no instantiation of a container is passed between the two translation units."
https://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode_using.html

@wch
Copy link
Owner Author

wch commented May 23, 2018

I've added _GLIBCXX_DEBUG (which in turn defines _GLIBCXX_ASSERTIONS) in a16eba3.

@david-cortes
Copy link

@wch It seems the macro is not currently active in these debug builds. Here I'm attaching a sample package which should trigger an assertion error for out-of-bounds access of a vector element when running the examples. There is no assertion error when testing the example, nor when installing the package and calling the function.
assertions_1.0.tar.gz

@wch
Copy link
Owner Author

wch commented Apr 2, 2021

@david-cortes I removed those flags because of #5. It is possible that the issue has been fixed by now in R itself and we can add those flags back, but I currently don't have time to test that out. If you test it out and you run R CMD check on several packages and they don't raise those warnings, then I'd be willing to add the flags back.

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

No branches or pull requests

2 participants