Travis-CI错误:安装nloptr包(R包检查)

3

我尝试使用travis-ci检查我的r包是否正确。我的包应该导入r包nloptr。当在"r":"oldrel"分支上时,travis-ci会报错。我在这里展示错误:

configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Warning in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz",  :
  "internal" method cannot handle https redirection to: 'https://github.com/stevengj/nlopt/releases/download/nlopt-2.4.2/nlopt-2.4.2.tar.gz'
switching to method = "libcurl" because of redirection to https
downloaded 0 bytes
Warning in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz",  :
  URL 'https://github-production-release-asset-2e65be.s3.amazonaws.com/12412122/5dd09f0a-6d59-11e7-9685-af3ea1aac9be?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20180127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20180127T205849Z&X-Amz-Expires=300&X-Amz-Signature=e6604ca4110973e167461335f8ffe6e340882219fd2a4ebc2a6065d4e416cc2e&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3Dnlopt-2.4.2.tar.gz&response-content-type=application%2Foctet-stream': status was '403 Forbidden'
Error in download.file(url = "http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz",  : 
  cannot download all files
Execution halted
/bin/tar: This does not look like a tar archive
gzip: stdin: unexpected end of file
/bin/tar: Child returned status 1
/bin/tar: Error is not recoverable: exiting now
Warning message:
In untar(tarfile = "nlopt-2.4.2.tar.gz") :
  '/bin/tar -xf 'nlopt-2.4.2.tar.gz'' returned error code 2
configure: Starting to install library to /tmp/RtmpCm39nC/R.INSTALL37f361a5b719/nloptr/nlopt-2.4.2
./configure: line 3325: cd: nlopt-2.4.2: No such file or directory
2个回答

1
所以,问题在于travis-ci不知道如何安装这个nlopt,而r包nloptr需要它。(travis-ci无法通过给定的url下载nlopt。)幸运的是,我们可以通过将这段代码添加到.travis.yml文件中告诉travis-ci另一种方法,从而帮助travis-ci以另一种方式安装nlopt。
apt_packages:
  - libnlopt-dev

现在,travis-ci可以为您提供良好的服务!

1

您应该将以下内容添加到您的.travis.yml中,因为它适用于基于容器或标准基础设施,而Chaoran Hu的答案仅适用于标准基础设施:

addons:
  apt:
    packages:
      - libnlopt-dev

请查看travis文档,了解为什么这个答案通常会起作用:https://docs.travis-ci.com/user/languages/r/#APT-packages

肯定的,Luke 给了我们一个更专业的建议! - Chaoran Hu

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接