Skip to content

Conversation

@FabrizioSandri
Copy link
Owner

Description

On some Linux based platforms, when installing a library using the R CMD INSTALL command, the binaries in the src folder are compiled omitting the -g parameter. The generated shared object for the library is missing debug symbols.

When installing a library using the R CMD INSTALL command on some Linux systems, the binaries in the src folder are built without the -g flag. The result is that debug symbols are missing from the library's created shared object.

When RcppDeepState and, in particular, Valgrind are used to evaluate such a package, the outcome is an empty table from the deepstate_harness_analyze_pkg function.
There appears to be no error, from the fuzz testing analysis. However, a closer look at the resulting XML file reveals some errors found by Valgrind: the problem is that the errors are related to the shared object file rather than the original function.

Fixes #2

Solution

The solution is to override the current Makevars file in order to set the additional pre processor option -g to the compilation procedure run by the R CMD INSTALL command. The right method to accomplish this, as specified on the R project documentation page, is to create Makevars file in the package's src folder before running the installation command.

The function deepstate_pkg_create in the pkg_harness_create.R file in RcppDeepState runs the R CMD INSTALL. The goal of the solution is to intercept this system shell call and produce the Makevars file before the compilation begins.

@FabrizioSandri
Copy link
Owner Author

@tdhock with this pull request I solved the issue in which some systems were building the tested library without including debugging symbols after the execution of R CMD INSTALL. This improvement of the library improves its portability.

@FabrizioSandri FabrizioSandri merged commit d611a25 into master Jun 9, 2022
@tdhock
Copy link
Collaborator

tdhock commented Jun 14, 2022

this is great. Do you have any tests for this? (you could probably do that using Github actions with a docker image for that system where -g is omitted by default)

@FabrizioSandri
Copy link
Owner Author

I added the tests in the pull request #6, where I created a specific GitHub Action to check if debug symbols are included or not in Arch Linux based systems.

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.

Segmentation fault not catched

3 participants