I am building an Rcpp package but i get devtools::check() ══ Documenting…
- User
I am building an Rcpp package but i get
devtools::check() ══ Documenting ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ ℹ Installed roxygen2 version (7.3.1) doesn't match required (7.1.1) ✖
check()will not re-document this package ══ Building ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ Setting env vars: • CFLAGS : -Wall -pedantic -fdiagnostics-color=always • CXXFLAGS : -Wall -pedantic -fdiagnostics-color=always • CXX11FLAGS: -Wall -pedantic -fdiagnostics-color=always • CXX14FLAGS: -Wall -pedantic -fdiagnostics-color=always • CXX17FLAGS: -Wall -pedantic -fdiagnostics-color=always • CXX20FLAGS: -Wall -pedantic -fdiagnostics-color=always ── R CMD build ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ✔ checking for file ‘/home/jakob/R/x86_64-pc-linux-gnu-library/4.4/BISAM/DESCRIPTION’ ... ─ preparing ‘BISAM’: ✔ checking DESCRIPTION meta-information ... ─ excluding invalid files Subdirectory 'R' contains invalid file names: ‘BISAM’ ‘BISAM.rdb’ ‘BISAM.rdx’ ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘BISAM/R’ WARNING: Removing directory ‘BISAM/Meta’ which should only occur in an installed package WARNING: Removing directory ‘BISAM/help’ which should only occur in an installed package WARNING: Removing directory ‘BISAM/html’ which should only occur in an installed package ─ building ‘BISAM_0.0.1.tar.gz’══ Checking ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════ Setting env vars: • R_CHECK_CRAN_INCOMING_REMOTE : FALSE • R_CHECK_CRAN_INCOMING : FALSE • R_CHECK_FORCE_SUGGESTS : FALSE • R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS: FALSE • NOT_CRAN : true ── R CMD check ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─ using log directory ‘/tmp/RtmphfZQQ3/file4b78a6751b1d3/BISAM.Rcheck’ ─ using R version 4.4.1 (2024-06-14) ─ using platform: x86_64-pc-linux-gnu ─ R was compiled by gcc (GCC) 14.1.1 20240522 GNU Fortran (GCC) 14.1.1 20240522 ─ running under: Arch Linux ─ using session charset: UTF-8 ─ using options ‘--no-manual --as-cran’ (621ms) ✔ checking for file ‘BISAM/DESCRIPTION’ ─ checking extension type ... Package ─ this is package ‘BISAM’ version ‘0.0.1’ ─ package encoding: UTF-8 ✔ checking package namespace information ✔ checking package dependencies (1.6s) E checking if this is a source package ... Only source packages can be checked.
See ‘/tmp/RtmphfZQQ3/file4b78a6751b1d3/BISAM.Rcheck/00check.log’ for details.
── R CMD check results ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── BISAM 0.0.1 ──── Duration: 3.5s
❯ checking if this is a source package ... ERROR Only source packages can be checked.
- Assistant
The error messages you're encountering during the
devtools::check()process indicate a few underlying issues with your package setup. Let's address each problem step-by-step to help you successfully build and check your Rcpp package.1. Roxygen2 Version Mismatch
Issue:
ℹ Installed roxygen2 version (7.3.1) doesn't match required (7.1.1) ✖ `check()` will not re-document this packageSolution: Your package specifies a dependency on
roxygen2version 7.1.1, but you have 7.3.1 installed. To resolve this:-
Option A: Update the Package's DESCRIPTION File
If possible, update the
DESCRIPTIONfile of your package to accept newer versions ofroxygen2. Open theDESCRIPTIONfile and locate theSuggestsorImportssection, then modify theroxygen2entry:Suggests: roxygen2 (>= 7.1.1)This change allows
roxygen2versions 7.1.1 and above, ensuring compatibility with your installed version. -
Option B: Install the Required Roxygen2 Version
If your package strictly requires
roxygen27.1.1, you can install this specific version from CRAN's archive:# Remove the current roxygen2 version remove.packages("roxygen2") # Install roxygen2 version 7.1.1 install.packages("https://cran.r-project.org/src/contrib/Archive/roxygen2/roxygen2_7.1.1.tar.gz", repos = NULL, type = "source")Note: Using older versions might miss out on important updates and bug fixes. It's generally recommended to update the
DESCRIPTIONfile unless there's a compelling reason to stick to an older version.
2. Invalid Files and Directories in the Source Package
Issue:
Subdirectory 'R' contains invalid file names: ‘BISAM’ ‘BISAM.rdb’ ‘BISAM.rdx’WARNING: Removing directory ‘BISAM/Meta’ which should only occur in an installed package WARNING: Removing directory ‘BISAM/help’ which should only occur in an installed package WARNING: Removing directory ‘BISAM/html’ which should only occur in an installed packageExplanation: The presence of
.rdb,.rdxfiles and directories likeMeta,help, andhtmlwithin your package's source directory indicates that you're including files that are meant only for the installed version of the package. These files should not be part of the source package.Solution:
-
Clean the Source Directory:
-
Remove Built Files: Navigate to the
R/directory of your package and ensure that only.Rsource files are present. Delete any.rdb,.rdx, or other non-source files. -
Delete Unnecessary Directories: Remove directories like
Meta,help, andhtmlfrom the root of your package directory. These are generated during the build and install processes and should not be part of the source.
-
-
Use
.gitignoreor Similar:If you're using version control (e.g., Git), update your
.gitignorefile to exclude these built files and directories to prevent them from being accidentally included in the source package.# R built files *.rdb *.rdx # Generated directories Meta/ help/ html/ -
Clean Using Devtools:
Utilize
devtoolsfunctions to clean up built artifacts:devtools::clean_dll()This command removes compiled shared objects and can help ensure that no residual build artifacts are present.
3. Finalizing the Check
After addressing the above issues, proceed with the following steps:
-
Regenerate Documentation:
Since there was a roxygen2 version mismatch, regenerate your documentation to ensure it's up-to-date.
devtools::document() -
Rebuild the Package:
Build your package to create a fresh source tarball.
devtools::build() -
Run the Check Again:
Execute the check to verify that all issues have been resolved.
devtools::check()
4. Additional Recommendations
-
Ensure Clean Source Control:
Make sure your source control (e.g., Git) repository contains only the necessary source files. Regularly check for accidentally committed build artifacts.
-
Continuous Integration (CI):
Implement CI tools (like GitHub Actions) to automate checks. This helps in maintaining package integrity across different environments.
-
Review
DESCRIPTIONandNAMESPACE:Ensure that all dependencies are correctly listed and that the
NAMESPACEfile accurately reflects the exported functions and imported packages.
5. Summary
The main issues stem from:
- Roxygen2 Version Mismatch: Align your package's
DESCRIPTIONwith your installedroxygen2version or adjust the installed version to match your package requirements. - Inclusion of Built Files: Clean your source package directory to exclude built artifacts and directories meant only for installed packages.
By meticulously cleaning your package directory and ensuring that dependencies are correctly specified, you should be able to successfully build and check your Rcpp package without encountering the aforementioned errors.
If issues persist, consider providing more details or the contents of the
00check.logfile mentioned in the error message. This log can offer more insights into specific problems during the check process. -