在Ubuntu 18.04和R 4.0.2上安装tidyr时出现错误。

14

尝试安装tidyverse包时,我在安装依赖项tidyr时遇到错误。

以下是我收到的消息尾部:

cpp11.cpp:31:100: error: ‘unmove’ is not a member of ‘cpp11’
     return cpp11::as_sexp(simplifyPieces(cpp11::unmove(cpp11::as_cpp<cpp11::list>(pieces)), cpp11::unmove(cpp11::as_cpp<int>(p)), cpp11::unmove(cpp11::as_cpp<bool>(fillLeft))));
                                                                                                    ^~~~~~
cpp11.cpp:31:138: error: ‘unmove’ is not a member of ‘cpp11’
     return cpp11::as_sexp(simplifyPieces(cpp11::unmove(cpp11::as_cpp<cpp11::list>(pieces)), cpp11::unmove(cpp11::as_cpp<int>(p)), cpp11::unmove(cpp11::as_cpp<bool>(fillLeft))));
                                                                                                                                          ^~~~~~
/usr/lib/R/etc/Makeconf:176: recipe for target 'cpp11.o' failed
make: *** [cpp11.o] Error 1
ERROR: compilation failed for package ‘tidyr’
* removing ‘/home/xxx/yyy/tidyr’
Warning in install.packages :
  installation of package ‘tidyr’ had non-zero exit status

以我幼稚的眼光看,似乎问题出在cpp11上。我看到一个类似的问题,涉及到tidyr安装错误,原因是由于cpp11编译错误(R tidyr package installation failed due to cpp11 compilation error (expansion pattern x contains no argument packs)),但该问题是针对RHEL系统的。

我在我的系统上安装了最新版本的gcc/c++(4:7.4.0-1ubuntu2.3)。最新版本的系统依赖项libcurl4-openssl-dev libssl-dev libxml2-dev也已安装。

这是sessionInfo()的输出:

R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

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

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

loaded via a namespace (and not attached):
 [1] rstudioapi_0.11   magrittr_1.5      usethis_1.6.1     devtools_2.3.1    pkgload_1.1.0     R6_2.4.1          rlang_0.4.7       fansi_0.4.1       tools_4.0.2      
[10] pkgbuild_1.1.0    sessioninfo_1.1.1 cli_2.0.2         withr_2.2.0       ellipsis_0.3.1    remotes_2.2.0     assertthat_0.2.1  digest_0.6.25     rprojroot_1.3-2  
[19] crayon_1.3.4      processx_3.4.3    callr_3.4.3       fs_1.5.0          ps_1.3.3          curl_4.3          testthat_2.3.2    memoise_1.1.0     glue_1.4.1       
[28] compiler_4.0.2    desc_1.2.0        backports_1.1.8   prettyunits_1.1.1

这里有一个非常相似的问题。最近几天我们在 Docker 机器上也出现了这个问题。我没有太多细节,但想提一下你不是唯一一个遇到这个问题的人! - djacobs7
4个回答

6

看起来@hadley几天前发布了一个tidyr的更新版本,基于新的cpp11软件包:https://github.com/tidyverse/tidyr/releases

由于某些原因,这导致tidyr无法为我们构建。

我们(暂时希望如此!)采取的解决方法如下:

(1) 删除对tidyverse的依赖。而是明确依赖子软件包(如dplyr/ggplot2等)

(2) 以以下方式安装tidyr:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/tidyr/tidyr_1.1.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

非常感谢,它起作用了。我遇到了这个错误有一段时间了:'ake: *** [cpp11.o] Error 1 ERROR: compilation failed for package ‘tidyr’ ─ removing ‘/tmp/RtmpIZOo8g/Rinstcc91657d2f02/tidyr’ - kcm

2

如果有人在他们的GitHub R包中依赖于tidyr,我发现将Remotes: github::r-lib/cpp11添加到我的包DESCRIPTION文件中可以使TRAVIS-CI成功构建。 - mkamenet3

1

0

基于 @djacobs7、@mkamenet3 和 @Leandro R. M. de Marco 的答案,我最终采用了以下解决方案,这对我很有效。

  1. 删除我从 CRAN 安装的 cpp11 包。
  2. 重新安装 cpp11 包,但这次是从 GitHub 安装,因为它包含了 @mkamenet3 提到的提交。
devtools::install_github("r-lib/cpp11")
  • 正常安装 tidyr
  • install.packages("tidyr")
    

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