加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

准备具有外部依赖关系的CRAN R包(nlopt)

发布时间:2020-12-14 04:55:32 所属栏目:百科 来源:网络整理
导读:我正在尝试向CRAN提交一个在预测试期间失败的软件包 Debian上的过程. 我使用了一些与nlopt优化接口的C代码 使用Rcpp / RcppArmadillo的库(使用 nlopt.hpp).因此,我的软件包需要一个系统版本的nlopt,可以通过deb软件包libnlopt-dev安装(我将它添加到SystemReq
我正在尝试向CRAN提交一个在预测试期间失败的软件包
Debian上的过程.

我使用了一些与nlopt优化接口的C代码
使用Rcpp / RcppArmadillo的库(使用< nlopt.hpp>).因此,我的软件包需要一个系统版本的nlopt,可以通过deb软件包libnlopt-dev安装(我将它添加到SystemRequirements字段).

我使用配置脚本和pkg-config来检索(希望如此)
适当的编译器标志,然后我发送到src / Makevars

NLOPT_LIBS=`pkg-config --libs ${PKG_CONFIG_NAME}`
NLOPT_FLAG=`pkg-config --cflags ${PKG_CONFIG_NAME}`

这种方法适用于我的系统(Ubuntu 18.04,R 3.5.2)和Travis
(linux和mac OS),但在Debian CRAN服务器上失败:
https://win-builder.r-project.org/incoming_pretest/PLNmodels_0.7_20190119_161032/Debian/00install.out

我添加了一些详细程度来检查标志是否正确导出
在CRAN服务器上,它们对我来说似乎没问题:至少,一个版本的
在系统上找到nlopt(见下文,NLOPT_LIBS = -lnlopt -lm).
但是,< nlopt.hpp>后来没有发现……

任何帮助将不胜感激.感谢您抽出宝贵时间阅读本文.

* installing *source* package ‘PLNmodels’ ...
Using NLOPT_LIBS=-lnlopt -lm
Using NLOPT_FLAG=
** libs
g++-8  -std=gnu++11 -I"/home/hornik/tmp/R/include" -DNDEBUG -fopenmp
-I"/home/hornik/lib/R/Library/3.6/x86_64-linux-gnu/Rcpp/include"
-I"/home/hornik/lib/R/Library/3.6/x86_64-linux-gnu/RcppArmadillo/include"
-I/usr/local/include -fopenmp  -fpic  -g -O2 -Wall -pedantic
-mtune=native -c RcppExports.cpp -o RcppExports.o
g++-8  -std=gnu++11 -I"/home/hornik/tmp/R/include" -DNDEBUG -fopenmp
-I"/home/hornik/lib/R/Library/3.6/x86_64-linux-gnu/Rcpp/include"
-I"/home/hornik/lib/R/Library/3.6/x86_64-linux-gnu/RcppArmadillo/include"
-I/usr/local/include -fopenmp  -fpic  -g -O2 -Wall -pedantic
-mtune=native -c call_nlopt_PLN_VE.cpp -o call_nlopt_PLN_VE.o
In file included from call_nlopt_PLN_VE.cpp:6:
utils.h:5:10: fatal error: nlopt.hpp: No such file or directory
 #include <nlopt.hpp>
          ^~~~~~~~~~~
compilation terminated.
make: *** [/home/hornik/tmp/R/etc/Makeconf:173: call_nlopt_PLN_VE.o] Error 1
ERROR: compilation failed for package ‘PLNmodels’
* removing ‘/srv/hornik/tmp/CRAN/PLNmodels.Rcheck/PLNmodels’

解决方法

nlopt的C接口已经迁移到Debian的一个单独的包中,c.f. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855600.所以看起来特定的CRAN机器使用Debian Testing或Stable Backports并且只安装了libnlopt-dev但没有安装libnlopt-cxx-dev.您必须联系CRAN维护者才能安装此依赖项.

顺便说一句,理想情况下,这样的错误应该在配置脚本中进行,即你应该尝试编译一个需要nlopt.hpp的简单程序.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读