首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于cpp11编译错误,r tidyr包安装失败(扩展模式x不包含参数包)

由于cpp11编译错误,r tidyr包安装失败(扩展模式x不包含参数包)
EN

Stack Overflow用户
提问于 2020-08-07 11:59:03
回答 3查看 1.3K关注 0票数 2

我有以下与cp11相关的错误。看起来cp11编译有错误,我不确定如何解决。

我尝试做的是卸载包并重新安装它。

我在RHEL 7上,gcc版本是4.8.5

代码语言:javascript
复制
> install.packages("tidyverse")
Installing package into ‘/datascience/R/x86_64-redhat-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
also installing the dependency ‘tidyr’

trying URL 'https://cran.rstudio.com/src/contrib/tidyr_1.1.1.tar.gz'
Content type 'application/x-gzip' length 879411 bytes (858 KB)
==================================================
downloaded 858 KB

trying URL 'https://cran.rstudio.com/src/contrib/tidyverse_1.3.0.tar.gz'
Content type 'application/x-gzip' length 712837 bytes (696 KB)
==================================================
downloaded 696 KB

* installing *source* package ‘tidyr’ ...
** package ‘tidyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG  -I"/usr/lib64/R/library/cpp11/include" -I/usr/local/include  -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic  -c cpp11.cpp -o cpp11.o
In file included from /usr/lib64/R/library/cpp11/include/cpp11/as.hpp:8:0,
                 from /usr/lib64/R/library/cpp11/include/cpp11.hpp:5,
                 from /usr/lib64/R/library/cpp11/include/cpp11/declarations.hpp:8,
                 from cpp11.cpp:4:
/usr/lib64/R/library/cpp11/include/cpp11/protect.hpp: In lambda function:
/usr/lib64/R/library/cpp11/include/cpp11/protect.hpp:185:52: error: parameter packs not expanded with ‘...’:
       return unwind_protect_sexp([&] { return ptr_(a...); });
                                                    ^
/usr/lib64/R/library/cpp11/include/cpp11/protect.hpp:185:52: note:         ‘a’
/usr/lib64/R/library/cpp11/include/cpp11/protect.hpp:185:53: error: expansion pattern ‘a’ contains no argument packs
       return unwind_protect_sexp([&] { return ptr_(a...); });
                                                     ^
make: *** [cpp11.o] Error 1
ERROR: compilation failed for package ‘tidyr’
* removing ‘/datascience/R/x86_64-redhat-linux-gnu-library/3.6/tidyr’
Warning in install.packages :
  installation of package ‘tidyr’ had non-zero exit status
ERROR: dependency ‘tidyr’ is not available for package ‘tidyverse’
* removing ‘/datascience/R/x86_64-redhat-linux-gnu-library/3.6/tidyverse’
Warning in install.packages :
  installation of package ‘tidyverse’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmp7JHlRI/downloaded_packages’
EN

回答 3

Stack Overflow用户

发布于 2020-08-10 00:15:19

正如@Maurits Evers所说,较新版本的gcc将正确编译tidyr。

代码语言:javascript
复制
#Enable the rhscl repository
yum-config-manager --enable rhel-server-rhscl-7-rpms

#Install devtooset-X
yum install devtoolset-X

#Open a shell with the required environment variables.
scl enable devtoolset-X bash

在那之后打开一个R shell。在非交互式脚本中使用的情况下,源scl使能文件,该文件将设置当前外壳中的环境变量

代码语言:javascript
复制
 source /opt/rh/devtoolset-X/enable
票数 1
EN

Stack Overflow用户

发布于 2020-08-11 02:53:51

我正处于完全相同的情况:尝试在R 3.6.1上安装tidyr,在cpp11和相同版本的gcc (4.8.5)中出现此错误。

我们将g++,gcc,cc+ cc更新为版本:(GCC) 9.3.1 20200408 (红帽9.3.1-2)版权所有(C) 2019年自由软件基金会,Inc.

在更新了GCC之后,我们重新安装了cpp11。

但是:

代码语言:javascript
复制
install.packages(
+   pkgs = "tidyr",
+   dependencies = TRUE,
+   repos = "https://cloud.r-project.org"
+ )
Installing package into ‘/dados/home/t03999/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/tidyr_1.1.1.tar.gz'
Content type 'application/x-gzip' length 879411 bytes (858 KB)
==================================================
downloaded 858 KB

* installing *source* package ‘tidyr’ ...
** package ‘tidyr’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -m64 -std=gnu++11 -I"/usr/lib64/R/../../include/R" -DNDEBUG  -I"/dados/home/t03999/R/x86_64-pc-linux-gnu-library/3.6/cpp11/include" -I/systemr/port/Linux-X64/include/zlib -I/systemr/port/Linux-X64/include/xz -I/systemr/port/Linux-X64/include/bzip2 -I/systemr/port/Linux-X64/include  -fpic  -g -O2  -c cpp11.cpp -o cpp11.o
cpp11.cpp: In function ‘SEXPREC* _tidyr_fillDown(SEXP)’:
cpp11.cpp:10:43: error: ‘unmove’ is not a member of ‘cpp11’
   10 |     return cpp11::as_sexp(fillDown(cpp11::unmove(cpp11::as_cpp<SEXP>(x))));
      |                                           ^~~~~~
cpp11.cpp: In function ‘SEXPREC* _tidyr_fillUp(SEXP)’:
cpp11.cpp:17:41: error: ‘unmove’ is not a member of ‘cpp11’
   17 |     return cpp11::as_sexp(fillUp(cpp11::unmove(cpp11::as_cpp<SEXP>(x))));
      |                                         ^~~~~~
cpp11.cpp: In function ‘SEXPREC* _tidyr_melt_dataframe(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP)’:
cpp11.cpp:24:49: error: ‘unmove’ is not a member of ‘cpp11’
   24 |     return cpp11::as_sexp(melt_dataframe(cpp11::unmove(cpp11::as_cpp<cpp11::data_frame>(data)), cpp11::unmove(cpp11::as_cpp<const cpp11::integers&>(id_ind)), cpp11::unmove(cpp11::as_cpp<const cpp11::integers&>(measure_ind)), cpp11::unmove(cpp11::as_cpp<cpp11::strings>(variable_name)), cpp11::unmove(cpp11::as_cpp<cpp11::strings>(value_name)), cpp11::unmove(cpp11::as_cpp<cpp11::sexp>(attrTemplate)), cpp11::unmove(cpp11::as_cpp<bool>(factorsAsStrings)), cpp11::unmove(cpp11::as_cpp<bool>(valueAsFactor)), cpp11::unmove(cpp11::as_cpp<bool>(variableAsFactor))));
      |                                                 ^~~~~~
cpp11.cpp:24:104: error: ‘unmove’ is not a member of ‘cpp11’

我们仍然不知道如何解决这个问题。

票数 1
EN

Stack Overflow用户

发布于 2020-08-11 11:34:54

我猜错误信息

代码语言:javascript
复制
 error: ‘unmove’ is not a member of ‘cpp11’

是由0.2.0版本的cpp11包中的持续变化引起的。这个Github issue提到了这个问题。解决我的问题的方法是在R中使用以下命令安装一个旧版本的cpp11:

代码语言:javascript
复制
packageurl <- "https://cloud.r-project.org/src/contrib/cpp11_0.1.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63294980

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档