Skip to content

Fail to build/document after usethis::use_rcpp() with empty src/ #720

@maurolepore

Description

@maurolepore

The sequence usethis::use_rcpp(), then "Clean and Rebuild", then devtools::document() fails with

Error in getDLLRegisteredRoutines.DLLInfo(dll, addNames = FALSE) :  must specify DLL via aDLLInfoobject. See getLoadedDLLs()

apparently, because "src/" contains no "file.cpp".

I expected this to work, maybe by automatically adding a src/toy-file.cpp. Or I expected a message with the following TODO items:

  • Add at least one .cpp file into src/
  • Clean and Reload
  • devtools::document()

Below is a sequence starting from a fresh package, leading to the problem, then solving it.

Details
# On a separate sassion
usethis::create_package("~/abc")

# New session
usethis::use_package_doc()
usethis::use_roxygen_md()
usethis::use_rcpp()

R/abc-package.R now looks like this:

#' @keywords internal
"_PACKAGE"

# The following block is used by usethis to automatically manage
# roxygen namespace tags. Modify with care!
## usethis namespace: start
#' @useDynLib abc, .registration = TRUE
#' @importFrom Rcpp sourceCpp
## usethis namespace: end
NULL

Problem

devtools::document()
Updating abc documentation
Writing NAMESPACE
Loading abc
Error in getDLLRegisteredRoutines.DLLInfo(dll, addNames = FALSE) : 
  must specify DLL via aDLLInfoobject. See getLoadedDLLs()
Call `rlang::last_error()` to see a backtrace

Clean and Rebuild also fails

Solution

usethis::use_rcpp("toy")

Now I can 'Clean and Rebuild'

And I can also document

devtools::document()
Updating abc documentation
Loading abc
Writing abc-package.Rd

Info

sessioninfo::session_info()
#> - Session info ----------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.5.3 (2019-03-11)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United States.1252  
#>  ctype    English_United States.1252  
#>  tz       America/New_York            
#>  date     2019-04-19                  
#> 
#> - Packages --------------------------------------------------------------
#>  package     * version date       lib source        
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 3.5.3)
#>  cli           1.1.0   2019-03-19 [1] CRAN (R 3.5.3)
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.5.2)
#>  digest        0.6.18  2018-10-10 [1] CRAN (R 3.5.2)
#>  evaluate      0.13    2019-02-12 [1] CRAN (R 3.5.2)
#>  highr         0.8     2019-03-20 [1] CRAN (R 3.5.3)
#>  htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.5.2)
#>  knitr         1.22    2019-03-08 [1] CRAN (R 3.5.2)
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.5.2)
#>  Rcpp          1.0.1   2019-03-17 [1] CRAN (R 3.5.3)
#>  rmarkdown     1.12    2019-03-14 [1] CRAN (R 3.5.2)
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.5.2)
#>  stringi       1.4.3   2019-03-12 [1] CRAN (R 3.5.3)
#>  stringr       1.4.0   2019-02-10 [1] CRAN (R 3.5.2)
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 3.5.2)
#>  xfun          0.6     2019-04-02 [1] CRAN (R 3.5.3)
#>  yaml          2.2.0   2018-07-25 [1] CRAN (R 3.5.2)
#> 
#> [1] C:/Users/LeporeM/Documents/R/win-library/3.5
#> [2] C:/Users/LeporeM/Documents/R/R-3.5.3/library

Created on 2019-04-19 by the reprex package (v0.2.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions