简体   繁体   English

由于缺少GSL,GN程序包构建在Unix机器上失败 - GNU Scientific Library

[英]R package build failing on Unix machines due to missing GSL - GNU Scientific Library

I am facing a particularly vexing problem with R package development. 我正面临着R包开发的一个特别棘手的问题。 My own package, called ggstatsplot ( https://github.com/IndrajeetPatil/ggstatsplot ), depends on userfriendlyscience , which depends on another package called MBESS , which itself ultimately depends on another package called gsl . 我自己的包,称为ggstatsplothttps://github.com/IndrajeetPatil/ggstatsplot ),取决于userfriendlyscience ,这依赖于其他软件包叫做MBESS ,这本身最终取决于另一个叫包gsl There is no problem at all for installation of ggstatsplot on a Windows machine (as assessed by AppVeyor continuous integration platform: https://ci.appveyor.com/project/IndrajeetPatil/ggstatsplot ). Windows机器上安装ggstatsplot没有任何问题(由AppVeyor持续集成平台评估: httpsAppVeyor )。

But whenever the package is to be installed on Unix machines, it throws the error that ggstatsplot can't be downloaded because userfriendlyscience and MBESS can't be downloaded because gsl can't be downloaded. 但每当包被在Unix机器上安装,它抛出的错误ggstatsplot不能下载,因为userfriendlyscienceMBESS不能下载,因为gsl不能下载。 The same thing is also revealed on Travis continuous integration platform with virtual Unix machines, where the package build fails ( https://travis-ci.org/IndrajeetPatil/ggstatsplot ). Travis持续集成平台与虚拟Unix机器也发生了同样的事情,其中​​包构建失败( https://travis-ci.org/IndrajeetPatil/ggstatsplot )。

Now one way to solve this problem for the user on the Unix machine is to configure GSL (as described here: installing R gsl package on Mac ), but I can't possibly expect every user of ggstatsplot to go through the arduous process of configuring GSL . 现在,在Unix机器上为用户解决这个问题的一种方法是配置GSL(如下所述: 在Mac上安装R gsl包 ),但我不可能指望ggstatsplot每个用户都要经历艰难的配置过程GSL I want them to just run install.packages("ggstatsplot") and be done with it. 我希望他们只运行install.packages("ggstatsplot")并完成它。

So I would really appreciate if anyone can offer me any helpful advice as to how I can make my package user's life simpler by removing this problem at its source. 所以我真的很感激,如果有人能提供任何有用的建议,我可以通过从源头上删除这个问题来简化我的包用户的生活。 Is there something I should include in the package itself that will take care of this on behalf of the user? 我是否应该在软件包本身中包含哪些内容来代表用户处理此问题?

This may not have a satisfying solution via changes to your R package (I'm not sure either way). 通过更改您的R包可能没有令人满意的解决方案(我不确定哪种方式)。 If the gsl package authors (which include a former R Core member) didn't configure it to avoid a pre-req installation of a linux package, there's probably a good reason not to. 如果gsl包作者(包括一个前R Core成员)没有配置它以避免pre-req安装linux包,那么可能有一个很好的理由不这样做。

But it may be some consolation that most R+Linux users understand that some R packages first require installing the underlying Linux libraries ( eg , through apt or dnf / yum ). 但是,大多数R + Linux用户都知道某些R软件包首先需要安装底层Linux库( 例如 ,通过aptdnf / yum ),这可能是一些安慰。

Primary Issue: making it easy for the users to install 主要问题:使用户可以轻松安装

Try to be super clear on the GitHub readme and the CRAN INSTALL file . 尝试在GitHub自述文件和CRAN INSTALL文件中超级清楚。 The gsl package has decent CRAN directions . gsl包具有不错的CRAN方向 This leads to the following bash code: 这导致以下bash代码:

sudo apt-get install libgsl0-dev

The best example of clear (linux pre-req package) documentation I've seen is from the curl and sf packages. 我见过的clear(linux pre-req包)文档的最好例子来自curlsf包。 sf 's CRAN page lists only the human names of the 3 libraries, but the GitHub page provides the exact bash commands for three major distribution branches. sfCRAN页面仅列出了3个库的人名,但GitHub页面为三个主要的分发分支提供了准确的bash命令。 The curl package does this very well too (eg, CRAN and GitHub ). 卷曲包也很好地完成了这一点(例如, CRANGitHub )。 For example, it provides the following explanation and bash code: 例如,它提供以下说明和bash代码:

Installation from source on Linux requires libcurl . 在Linux上从源代码安装需要libcurl On Debian or Ubuntu use libcurl4-openssl-dev : DebianUbuntu上使用libcurl4-openssl-dev

sudo apt-get install -y libcurl-dev

Ideally your documentation would describe how do install the gsl linux package on multiple distributions. 理想情况下,您的文档将描述如何在多个发行版上安装gsl linux软件包。

Disclaimer: I've never developed a package that directly requires a Linux package, but I use them a lot. 免责声明:我从未开发过直接需要Linux软件包的软件包,但我经常使用它们。 In case more examples would help, this doc includes a script I use to install stuff on new Ubuntu machines. 如果有更多的例子可以帮助, 这个文档包括我用来在新的Ubuntu机器上安装东西的脚本。 Some commands were stated explicitly in the package documentation; 一些命令在包文档中明确说明; some had little or no documentation, and required research. 有些人很少或没有文件,需要研究。

edit 2018-04-07 : I encountered my new favorite example: the sys package uses a config file to produce the following message in the R console. 编辑2018-04-07 :我遇到了我最喜欢的新例子: sys包使用配置文件在R控制台中生成以下消息。 While installing 100+ packages on a new computer, it was nice to see this direct message, and not have to track down the R package and the documentation about its dependencies. 在新计算机上安装100多个软件包时,很高兴看到这个直接消息,而不必追踪R软件包及其依赖项的文档。

On Debian/Ubuntu this package requires AppArmor. 在Debian / Ubuntu上,这个包需要AppArmor。

Please run: sudo apt-get install libapparmor-dev 请运行:sudo apt-get install libapparmor-dev

Another good one is pdftools , that also uses a config file (and is also developed by Jeroen Ooms ). 另一个好的是pdftools ,它也使用配置文件(也由Jeroen Ooms开发)。

Secondary Issue: installing on Travis 次要问题:在Travis上安装

The userfriendly travis config file apparently installs a lot of binaries directly (including gsl ), unlike the current ggstatsplot version . 用户友好的travis配置文件显然直接安装了很多二进制文件(包括gsl ),这与当前的ggstatsplot版本不同

Alternatively, I'm more familiar with telling travis to install the linux package, as demonstrated by curl's config file . 或者,我更熟悉告诉travis安装linux软件包,如curl的配置文件所示 As a bonus, this probably more closely replicates what typical users do on their own machines. 作为奖励,这可能更接近复制典型用户在自己的机器上所做的事情。

addons:
  apt:
    packages:
    - libcurl4-openssl-dev

Follow up 2018-03-13 Indrajeet and I tweaked the travis file so it's working. 跟进 2018-03-13 Indrajeet,我调整了travis文件,以便它正常工作。 Two sections were changed in the yaml file: 在yaml文件中更改两个部分

  1. The libgsl0-dev entry was added under the packages section (similar to the libcurl4-openssl-dev entry above). libgsl0-dev条目添加在packages部分下(类似于上面的libcurl4-openssl-dev条目)。
  2. Packages were listed in the r_binary_packages section so they install as binaries. 软件包列在r_binary_packages部分中,因此它们作为二进制文件安装。 The build was timing out after 50 minutes, and now it's under 10 min. 构建在50分钟后超时,现在不到10分钟。 In this particular package, the r_binary_packages section was nested in the Linux part of the Travis matrix so it wouldn't interfere with his two OS X jobs on Travis. 在这个特定的包中, r_binary_packages部分嵌套在Travis矩阵的Linux部分中,因此它不会干扰他在Travis上的两个OS X作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM