R CMD 检查查找不存在的文件
R CMD check looks for nonexisting file
R CMD 检查在为延迟加载准备包时查找不存在的 .R 文件,Rcpp.package.skeleton 生成看似损坏的 RcppExports.cpp
文件。
我正在尝试使用 Rcpp 构建一个 R 包,通过调用来设置它
Rcpp.package.skeleton。这会产生一个看似损坏的 RcppExports.cpp
文件(重复函数定义)。
手动修正此文件后我运行 devtools::check() 在此,编译和链接成功并构建了dll。但随后 R CMD check
的以下输出
** 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)。
提前致谢!
你的回购/代码有问题:
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$
包装纸来自 littler,无关紧要。您的代码很糟糕——它无法构建。注意警告和注意事项。全部。
编译器告诉我无数次重新定义。你这里似乎有问题。一开始尝试一些更简单的东西,让它发挥作用,然后从那里开始。
该代码中有很多错误:
- 在函数声明和定义之前重复
// [[Rcpp::export]]
。这导致编译 RcppExports.cpp
. 的重定义错误
- 在某些文件中使用
string
而不是 std::string
或 using std::string
。
代码 不能 是包的一部分,例如compileCpp.R
:
source("src/Env.R")
library(Rcpp)
作为第一个近似值,R
中的文件应该只包含函数定义。
R CMD 检查在为延迟加载准备包时查找不存在的 .R 文件,Rcpp.package.skeleton 生成看似损坏的 RcppExports.cpp 文件。
我正在尝试使用 Rcpp 构建一个 R 包,通过调用来设置它 Rcpp.package.skeleton。这会产生一个看似损坏的 RcppExports.cpp 文件(重复函数定义)。
手动修正此文件后我运行 devtools::check() 在此,编译和链接成功并构建了dll。但随后 R CMD check
的以下输出 ** 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)。
提前致谢!
你的回购/代码有问题:
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$
包装纸来自 littler,无关紧要。您的代码很糟糕——它无法构建。注意警告和注意事项。全部。
编译器告诉我无数次重新定义。你这里似乎有问题。一开始尝试一些更简单的东西,让它发挥作用,然后从那里开始。
该代码中有很多错误:
- 在函数声明和定义之前重复
// [[Rcpp::export]]
。这导致编译RcppExports.cpp
. 的重定义错误
- 在某些文件中使用
string
而不是std::string
或using std::string
。 代码 不能 是包的一部分,例如
compileCpp.R
:source("src/Env.R") library(Rcpp)
作为第一个近似值,R
中的文件应该只包含函数定义。