gpt4 book ai didi

Rcpp 模块在 Rcpp 0.12.11 中不起作用

转载 作者:行者123 更新时间:2023-12-04 03:12:06 25 4
gpt4 key购买 nike

更新 Rcpp 后,我的模块代码停止工作,我可以通过尝试安装通过 Rcpp::Rcpp.package.skeleton("foo", module=TRUE) 创建的测试包来重现这一点.

输出如下:

$ Rscript -e "Rcpp::Rcpp.package.skeleton('foo', module = TRUE)"
Creating directories ...
...
$ R CMD INSTALL foo
* installing to library ‘/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4’
* installing *source* package ‘foo’ ...
** libs
g++-6 -I/usr/lib64/R/include -DNDEBUG -I"/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -O3 -c Num.cpp -o Num.o
g++-6 -I/usr/lib64/R/include -DNDEBUG -I"/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -O3 -c RcppExports.cpp -o RcppExports.o
g++-6 -I/usr/lib64/R/include -DNDEBUG -I"/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -O3 -c rcpp_hello_world.cpp -o rcpp_hello_world.o
g++-6 -I/usr/lib64/R/include -DNDEBUG -I"/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -O3 -c rcpp_module.cpp -o rcpp_module.o
g++-6 -I/usr/lib64/R/include -DNDEBUG -I"/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include -fpic -O3 -c stdVector.cpp -o stdVector.o
g++-6 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o foo.so Num.o RcppExports.o rcpp_hello_world.o rcpp_module.o stdVector.o -L/usr/lib64/R/lib -lR
installing to /home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/foo/libs
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘foo’ in .doLoadActions(where, attach):
error in load action .__A__.1 for package foo: loadModule(module = "NumEx", what = TRUE, env = ns, loadNow = TRUE): Unable to load module "NumEx": Failed to initialize module pointer: Error in FUN(X[[i]], ...): no such symbol _rcpp_module_boot_NumEx in package foo

Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/SMARTODDS/pollockj/R/x86_64-suse-linux-gnu-library/3.4/foo’

关于如何修复的任何想法,或者这是最新 Rcpp 中的错误?

> packageVersion("Rcpp")
[1] ‘0.12.11’
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: SUSE Linux Enterprise Desktop 12 SP2

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas_serial.so.0

locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8
[4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_3.4.0

最佳答案

我可以确认 Rcpp.package.skeleton() 中的错误,即使使用更新的 Rcpp 0.12.11.1。

但是看看我们包含在包中的示例 Rcpp 模块包,特别是它的 src/init.c文件。我相当确定我是自动生成的,所以我们应该能够通过适当调用 tools::package_native_routine_registration_skeleton() 来修复骨架生成器。

至此,感谢您提交错误报告。您可以(现在)也许手动调整 src/init.c。我提交了 issue ticket所以我们将看到如何修复临时 Rcpp 0.12.11.2 的问题。

关于Rcpp 模块在 Rcpp 0.12.11 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44331117/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com