R检查在准备用于延迟加载的包时查找不存在的.R文件,Rcpp.package.skeleton生成看似损坏的RcppExports.cpp文件。
我正在尝试使用Rcpp构建一个R包,通过调用Rcpp.package.skeleton来设置它。这会产生一个看似损坏的RcppExports.cpp文件(重复的函数定义)。
在手动更正该文件后,我运行devtools::check(),编译和链接成功,并生成dll。但是,下面是R CMD检查的输出
** R
** data
** byte-compile and prepare package for lazy loading
Reading DataUtils.R
Reading Env.R
Reading Paths.R
Reading RcppExports.R
Reading StatUtils.R
Reading SynData.R
Warnung in file(filename, "r", encoding = encoding)
cannot open file 'src/Env.R': No such file or directory
Error in file(filename, "r", encoding = encoding) :
cannot open file connection
Error : unable to load R code in package 'ZA'
ERROR: lazy loading failed for package 'ZA'
* removing 'C:/Users/MeyerM/Projects/R/ZA/ZA.Rcheck/ZA'
In R CMD INSTALL它为什么要查找"src/Env.R“文件?
包可以从https://github.com/spyqqqdia/ZAp (文件ZAp.zip)获得。
提前感谢!
发布于 2019-01-11 09:41:45
该代码中有许多错误:
// [[Rcpp::export]]。这将导致编译RcppExports.cpp时出现重新定义错误。string而不是std::string或using std::string。compileCpp.R:
来源(“src/env.R”)库(Rcpp)首先,R中的文件应该只包含函数定义。
发布于 2019-01-10 20:58:43
您的回购/代码是错误的:
edd@rob:/tmp/so$ git clone git@github.com:spyqqqdia/ZAp.git
Cloning into 'ZAp'...
remote: Enumerating objects: 52, done.
remote: Counting objects: 100% (52/52), done.
remote: Compressing objects: 100% (49/49), done.
remote: Total 52 (delta 3), reused 52 (delta 3), pack-reused 0
Receiving objects: 100% (52/52), 31.78 KiB | 986.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
edd@rob:/tmp/so$ ls
ZAp
edd@rob:/tmp/so$ build.r ZAp # R CMD build wrapper
* checking for file ‘ZAp/DESCRIPTION’ ... OK
* preparing ‘ZAp’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘ZAp_1.0.tar.gz’
edd@rob:/tmp/so$ rcc.r ZAp_1.0.tar.gz # R CMD check wrapper
── R CMD check ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
─ using log directory ‘/tmp/file3d684dd243a4/ZAp.Rcheck’
─ using R version 3.5.2 (2018-12-20)
─ using platform: x86_64-pc-linux-gnu (64-bit)
─ using session charset: UTF-8
✔ checking for file ‘ZAp/DESCRIPTION’ ...
─ checking extension type ... Package
─ this is package ‘ZAp’ version ‘1.0’
✔ checking package namespace information
✔ checking package dependencies (519ms)
W checking if this is a source package
Subdirectory ‘src’ contains:
PathGenerator.hpp matrix.hpp paths.hpp swap.hpp swapprogram.hpp
utils.hpp
These are unlikely file names for src files.
✔ checking if there is a namespace
✔ checking for executable files ...
✔ checking for hidden files and directories
✔ checking for portable file names
✔ checking for sufficient/correct file permissions
E checking whether package ‘ZAp’ can be installed (5.1s)
See
‘/tmp/file3d684dd243a4/ZAp.Rcheck/00check.log’
for details.
Installation failed.
See ‘/tmp/file3d684dd243a4/ZAp.Rcheck/00install.out’ for details.
edd@rob:/tmp/so$包装纸太小了,不重要。您的代码是错误的-它不构建。注意警告和笔记。他们所有人。
编译器告诉我大量的重新定义。你在这里似乎有问题。尝试一些简单的开始,让它发挥作用,从那里建立起来。
https://stackoverflow.com/questions/54130667
复制相似问题