0

我试图在我的包中依赖,但是当我尝试在我的包目录中运行命令时RcppArmadillo出现错误。但是,在交互式 R 会话中按照https://stackoverflow.com/a/14165455上的说明可以正常工作。我也在我的包目录中运行了它,它似乎生成了正确的。我究竟做错了什么?unable to load shared object /tmp/Rtmp0LswYZ/Rinst82cbed4eaee/00LOCK-alt.raster/00new/alt.raster/libs/alt.raster.so: undefined symbol: dsyev_R CMD build .R -e 'Rcpp::compileAttributes()'RcppExports.cpp

4

1 回答 1

4

正如上面的评论所推测的,从一个工作示例开始是非常有益的。

为了创建一个,我们提供了RcppArmadillo.package.skeleton()功能。按如下方式使用它:

edd@rob:/tmp$ Rscript -e 'RcppArmadillo::RcppArmadillo.package.skeleton("demoPkg")'

Calling kitten to create basic package.
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './demoPkg/Read-and-delete-me'.

Adding pkgKitten overrides.
 >> added .gitignore file
 >> added .Rbuildignore file
Deleted 'Read-and-delete-me'.
Done.

Consider reading the documentation for all the packaging details.
A good start is the 'Writing R Extensions' manual.

And run 'R CMD check'. Run it frequently. And think of those kittens.


Adding RcppArmadillo settings
 >> added Imports: Rcpp
 >> added LinkingTo: Rcpp, RcppArmadillo
 >> added useDynLib and importFrom directives to NAMESPACE
 >> added Makevars file with Rcpp settings
 >> added Makevars.win file with RcppArmadillo settings
 >> added example src file using armadillo classes
 >> added example Rd file for using armadillo classes
 >> invoked Rcpp::compileAttributes to create wrappers
edd@rob:/tmp$ 

它应该创建这些文件:

edd@rob:/tmp$ tree demoPkg/
demoPkg/
├── DESCRIPTION
├── man
│   ├── demoPkg-package.Rd
│   ├── hello.Rd
│   └── rcpparma_hello_world.Rd
├── NAMESPACE
├── R
│   ├── hello.R
│   └── RcppExports.R
└── src
    ├── Makevars
    ├── Makevars.win
    ├── rcpparma_hello_world.cpp
    └── RcppExports.cpp

3 directories, 11 files
edd@rob:/tmp$ 
于 2020-07-15T03:25:29.643 回答