akhikolla / RcppDeepState

RcppDeepState, a simple way to fuzz test code in Rcpp packages
https://akhikolla.github.io./
8 stars 2 forks source link

Error there is no package Rcpp #46

Closed tdhock closed 4 years ago

tdhock commented 4 years ago
(base) tdhock@maude-MacBookPro:~/R/binsegRcpp/inst/testfiles/rcpp_binseg_normal$ valgrind --tool=memcheck --leak-check=yes --track-origins=yes ./rcpp_binseg_normal_DeepState_TestHarness --fuzz --fuzz_save_passing --output_test_dir ~/R/binsegRcpp//inst/testfiles/rcpp_binseg_normal/rcpp_binseg_normal_output 
==3293== Memcheck, a memory error detector
==3293== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3293== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==3293== Command: ./rcpp_binseg_normal_DeepState_TestHarness --fuzz --fuzz_save_passing --output_test_dir /home/tdhock/R/binsegRcpp//inst/testfiles/rcpp_binseg_normal/rcpp_binseg_normal_output
==3293== 
INFO: Starting fuzzing
WARNING: No seed provided; using 1598548254
WARNING: No test specified, defaulting to first test defined (binsegRcpp_deepstate_test_rcpp_binseg_normal_test)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3298== 
==3298== HEAP SUMMARY:
==3298==     in use at exit: 38,187,132 bytes in 7,281 blocks
==3298==   total heap usage: 19,771 allocs, 12,490 frees, 63,148,007 bytes allocated
==3298== 
==3298== LEAK SUMMARY:
==3298==    definitely lost: 0 bytes in 0 blocks
==3298==    indirectly lost: 0 bytes in 0 blocks
==3298==      possibly lost: 0 bytes in 0 blocks
==3298==    still reachable: 38,187,132 bytes in 7,281 blocks
==3298==                       of which reachable via heuristic:
==3298==                         newarray           : 4,264 bytes in 1 blocks
==3298==         suppressed: 0 bytes in 0 blocks
==3298== Reachable blocks (those to which a pointer was found) are not shown.
==3298== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3298== 
==3298== For counts of detected and suppressed errors, rerun with: -v
==3298== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3304== 
==3304== HEAP SUMMARY:
==3304==     in use at exit: 38,187,132 bytes in 7,281 blocks
==3304==   total heap usage: 19,771 allocs, 12,490 frees, 63,148,007 bytes allocated
==3304== 
==3304== LEAK SUMMARY:
==3304==    definitely lost: 0 bytes in 0 blocks
==3304==    indirectly lost: 0 bytes in 0 blocks
==3304==      possibly lost: 0 bytes in 0 blocks
==3304==    still reachable: 38,187,132 bytes in 7,281 blocks
==3304==                       of which reachable via heuristic:
==3304==                         newarray           : 4,264 bytes in 1 blocks
==3304==         suppressed: 0 bytes in 0 blocks
==3304== Reachable blocks (those to which a pointer was found) are not shown.
==3304== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3304== 
==3304== For counts of detected and suppressed errors, rerun with: -v
==3304== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3316== 
==3316== HEAP SUMMARY:
==3316==     in use at exit: 38,187,131 bytes in 7,281 blocks
==3316==   total heap usage: 19,771 allocs, 12,490 frees, 63,148,006 bytes allocated
==3316== 
==3316== LEAK SUMMARY:
==3316==    definitely lost: 0 bytes in 0 blocks
==3316==    indirectly lost: 0 bytes in 0 blocks
==3316==      possibly lost: 0 bytes in 0 blocks
==3316==    still reachable: 38,187,131 bytes in 7,281 blocks
==3316==                       of which reachable via heuristic:
==3316==                         newarray           : 4,264 bytes in 1 blocks
==3316==         suppressed: 0 bytes in 0 blocks
==3316== Reachable blocks (those to which a pointer was found) are not shown.
==3316== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3316== 
==3316== For counts of detected and suppressed errors, rerun with: -v
==3316== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3348== 
==3348== HEAP SUMMARY:
==3348==     in use at exit: 38,187,980 bytes in 7,282 blocks
==3348==   total heap usage: 19,772 allocs, 12,490 frees, 63,148,855 bytes allocated
==3348== 
==3348== LEAK SUMMARY:
==3348==    definitely lost: 0 bytes in 0 blocks
==3348==    indirectly lost: 0 bytes in 0 blocks
==3348==      possibly lost: 0 bytes in 0 blocks
==3348==    still reachable: 38,187,980 bytes in 7,282 blocks
==3348==                       of which reachable via heuristic:
==3348==                         newarray           : 4,264 bytes in 1 blocks
==3348==         suppressed: 0 bytes in 0 blocks
==3348== Reachable blocks (those to which a pointer was found) are not shown.
==3348== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3348== 
==3348== For counts of detected and suppressed errors, rerun with: -v
==3348== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3355== 
==3355== HEAP SUMMARY:
==3355==     in use at exit: 38,187,324 bytes in 7,282 blocks
==3355==   total heap usage: 19,772 allocs, 12,490 frees, 63,148,199 bytes allocated
==3355== 
==3355== LEAK SUMMARY:
==3355==    definitely lost: 0 bytes in 0 blocks
==3355==    indirectly lost: 0 bytes in 0 blocks
==3355==      possibly lost: 0 bytes in 0 blocks
==3355==    still reachable: 38,187,324 bytes in 7,282 blocks
==3355==                       of which reachable via heuristic:
==3355==                         newarray           : 4,264 bytes in 1 blocks
==3355==         suppressed: 0 bytes in 0 blocks
==3355== Reachable blocks (those to which a pointer was found) are not shown.
==3355== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3355== 
==3355== For counts of detected and suppressed errors, rerun with: -v
==3355== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
INFO: Done fuzzing! Ran 5 tests (0 tests/second) with 5 failed/0 passed/0 abandoned tests
==3293== 
==3293== HEAP SUMMARY:
==3293==     in use at exit: 8 bytes in 1 blocks
==3293==   total heap usage: 4 allocs, 3 frees, 106,568 bytes allocated
==3293== 
==3293== LEAK SUMMARY:
==3293==    definitely lost: 0 bytes in 0 blocks
==3293==    indirectly lost: 0 bytes in 0 blocks
==3293==      possibly lost: 0 bytes in 0 blocks
==3293==    still reachable: 8 bytes in 1 blocks
==3293==         suppressed: 0 bytes in 0 blocks
==3293== Reachable blocks (those to which a pointer was found) are not shown.
==3293== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3293== 
==3293== For counts of detected and suppressed errors, rerun with: -v
==3293== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
(base) tdhock@maude-MacBookPro:~/R/binsegRcpp/inst/testfiles/rcpp_binseg_normal$ 
tdhock commented 4 years ago

this is also happening for another package on my system,

(base) tdhock@maude-MacBookPro:~/R/LOPART/inst/testfiles/LOPART_interface$ valgrind --tool=memcheck --leak-check=yes --track-origins=yes ./LOPART_interface_DeepState_TestHarness --fuzz --fuzz_save_passing --output_test_dir ~/R/LOPART/inst/testfiles/LOPART_interface/LOPART_interface_output 
==3542== Memcheck, a memory error detector
==3542== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3542== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==3542== Command: ./LOPART_interface_DeepState_TestHarness --fuzz --fuzz_save_passing --output_test_dir /home/tdhock/R/LOPART/inst/testfiles/LOPART_interface/LOPART_interface_output
==3542== 
INFO: Starting fuzzing
WARNING: No seed provided; using 1598548771
WARNING: No test specified, defaulting to first test defined (LOPART_deepstate_test_LOPART_interface_test)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3543== 
==3543== HEAP SUMMARY:
==3543==     in use at exit: 38,187,900 bytes in 7,282 blocks
==3543==   total heap usage: 19,772 allocs, 12,490 frees, 63,149,151 bytes allocated
==3543== 
==3543== LEAK SUMMARY:
==3543==    definitely lost: 0 bytes in 0 blocks
==3543==    indirectly lost: 0 bytes in 0 blocks
==3543==      possibly lost: 0 bytes in 0 blocks
==3543==    still reachable: 38,187,900 bytes in 7,282 blocks
==3543==                       of which reachable via heuristic:
==3543==                         newarray           : 4,264 bytes in 1 blocks
==3543==         suppressed: 0 bytes in 0 blocks
==3543== Reachable blocks (those to which a pointer was found) are not shown.
==3543== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3543== 
==3543== For counts of detected and suppressed errors, rerun with: -v
==3543== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
EXTERNAL: Warning message:

EXTERNAL: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
EXTERNAL: 

EXTERNAL:  there is no package called ‘Rcpp’

input starts
EXTERNAL: Error: function 'dataptr' not provided by package 'Rcpp'

EXTERNAL: Execution halted

==3553== 
==3553== HEAP SUMMARY:
==3553==     in use at exit: 38,187,964 bytes in 7,282 blocks
==3553==   total heap usage: 19,772 allocs, 12,490 frees, 63,149,215 bytes allocated
==3553== 
==3553== LEAK SUMMARY:
==3553==    definitely lost: 0 bytes in 0 blocks
==3553==    indirectly lost: 0 bytes in 0 blocks
==3553==      possibly lost: 0 bytes in 0 blocks
==3553==    still reachable: 38,187,964 bytes in 7,282 blocks
==3553==                       of which reachable via heuristic:
==3553==                         newarray           : 4,264 bytes in 1 blocks
==3553==         suppressed: 0 bytes in 0 blocks
==3553== Reachable blocks (those to which a pointer was found) are not shown.
==3553== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==3553== 
==3553== For counts of detected and suppressed errors, rerun with: -v
==3553== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 46 from 1)
tdhock commented 4 years ago

Rcpp is installed on my system

(base) tdhock@maude-MacBookPro:~/R/LOPART/inst/testfiles/LOPART_interface$ R --vanilla -e 'system.file(package="Rcpp")'

R version 4.0.2 (2020-06-22) -- "Taking Off Again"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> system.file(package="Rcpp")
[1] "/home/tdhock/R/x86_64-pc-linux-gnu-library/4.0/Rcpp"
> 
> 
(base) tdhock@maude-MacBookPro:~/R/LOPART/inst/testfiles/LOPART_interface$ 
tdhock commented 4 years ago

Rinside seems to be looking in ~/lib/R/library but Rcpp is in ~/R/x86_64-pc-linux-gnu-library/4.0/Rcpp .. I posted a message on the rcpp-devel email list to ask how to fix.

akhikolla commented 4 years ago

@tdhock can you please try running devtools::load_all() and then try to compile the package again.

After running the devtools::load_all() your makefile changes the library path to ~/lib/R/library instead of ~/R/x86_64-pc-linux-gnu-library/4.0/Rcpp. Please let me know if the make run was successful after this?

tdhock commented 4 years ago

| I'm having this issue | https://stackoverflow.com/questions/16758129/error-in-loadnamespacename-there-is-no-package-called-rcpp | Rcpp is installed in ~/R/x86_64-pc-linux-gnu-library/4.0 | But my RInside compiled binary looks for packages in ~/lib/R/library | Is there a way to configure the default library when I compile my command | line program with RInside?

Should be. There is no hidden magic anywhere. RInside uses values it sees when building. Having an identical .libPaths() (or R_LIBS_USER / R_LIBS_SITE) should be all you need.

Maybe start by figuring out how it knows about ~/lib/R/library?

| Otherwise, is there a recommended approach for doing run-time configuration | of the library? I | tried.R.parseEvalQ(".libPaths('~/R/x86_64-pc-linux-gnu-library/4.0')") but | that does not seem to work.

That should work too.

That should work too.

| Thanks for any help/ideas

An MCVE may help. RInside ships with 1 1/2 dozen examples just in its examples/standard directory and has eight more specialised examples directory.

akhikolla commented 4 years ago

We need to run devtools::load_all() first and then generate the makefiles then it will point to the correct library paths.

tdhock commented 4 years ago

you run load_all in what directory?

akhikolla commented 4 years ago

Please run it in the project root directory and generate the makefiles.

tdhock commented 4 years ago

what project?

akhikolla commented 4 years ago

I am sorry I am confused now aren't the library paths supposed to be in ~/lib/R/library instead of ~/R/x86_64-pc-linux-gnu-library/4.0/Rcpp?. If that's not the case devtools::load_all() will not work. We are using system.file() to get the package paths here, if system.file() method is executed after loading the package with load_all() it gives the system.file(package="RcppDeepState") something like /home/akhila/R/RcppDeepState/inst.

If we don't use load_all() the system.file() package it gives base::system.file(package="RcppDeepState") which is "/home/akhila/R/x86_64-pc-linux-gnu-library/3.6/RcppDeepState"

> library(RcppDeepState)
> system.file(package="RcppDeepState")
[1] "/home/akhila/R/x86_64-pc-linux-gnu-library/3.6/RcppDeepState"
> devtools::load_all()
Loading RcppDeepState
Re-compiling RcppDeepState
─  installing *source* package ‘RcppDeepState’ ...
   ** using staged installation
─  DONE (RcppDeepState)
> system.file(package="RcppDeepState")
[1] "/home/akhila/R/RcppDeepState/inst"
tdhock commented 4 years ago

the library paths are different on every system. you can use .libPaths() to see what the current paths are, or add a path. when you use system.file(package="something") it takes the first package that occurs on the current paths. Please do not assume that the user has devtools::load_all() -- I don't think it should be necessary.

tdhock commented 4 years ago

seems to be working with code on new master, thanks

tdhock commented 4 years ago

EXTERNAL: there is no package called ‘Rcpp’

can be fixed by specifying the library via R_LIBS_USER environment variable, e.g.

R_LIBS_USER='~/R/x86_64-pc-linux-gnu-library/4.0' ./rcpp_binseg_normal_DeepState_TestHarness