【问题标题】:Rfast installation: /usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failedRfast 安装:/usr/lib/R/etc/Makeconf:168:目标“Norm.o”的配方失败
【发布时间】:2019-01-10 16:59:43
【问题描述】:

我正在尝试安装 Rfast 软件包。它给了我以下错误,

/usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed
    make: *** [Norm.o] Error 1

完整的错误信息是这样的,

> install.packages("Rfast", dependencies = TRUE)

* installing *source* package 'Rfast' ...
** package 'Rfast' successfully unpacked and MD5 sums checked
** libs
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG  -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/include"   -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Diag.cpp -o Diag.o
g++ -std=gnu++11 -I/usr/share/R/include -DNDEBUG  -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/haseeb/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/include"   -fopenmp -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-AitvI6/r-base-3.4.4=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Norm.cpp -o Norm.o
In file included from Norm.cpp:4:0:
templates.h: In function 'SEXPREC* eachrow_helper(SEXP, SEXP)':
templates.h:904:15: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
   T *xx=(T *) DATAPTR(x),*xend=xx+ncol*nrow,*yy=(T *) DATAPTR(y),yvalue,*x3;
               ^~~~~~~
templates.h:904:15: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
templates.h:904:55: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
   T *xx=(T *) DATAPTR(x),*xend=xx+ncol*nrow,*yy=(T *) DATAPTR(y),yvalue,*x3;
                                                       ^~~~~~~
templates.h:905:32: error: there are no arguments to 'DATAPTR' that depend on a template parameter, so a declaration of 'DATAPTR' must be available [-fpermissive]
   RETURN_TYPE *m=(RETURN_TYPE*)DATAPTR(mat);
                                ^~~~~~~
/usr/lib/R/etc/Makeconf:168: recipe for target 'Norm.o' failed
make: *** [Norm.o] Error 1
ERROR: compilation failed for package 'Rfast'

我的sessioninfo如下,

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 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=C                 LC_NUMERIC=C               LC_TIME=de_DE.UTF-8       
 [4] LC_COLLATE=C               LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=C             
 [7] LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

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

loaded via a namespace (and not attached):
[1] compiler_3.4.4 tools_3.4.4    yaml_2.2.0 

有人可以帮我解决这个问题吗?

【问题讨论】:

  • 能否显示错误前后的两三行?您引用的内容不提供信息。 Rfast 应该干净地安装在这个平台上。
  • 在这里,pastebin.com/94D9jUSz
  • 请将其中的(合理的)部分编辑到问题中。请参阅creating a mcve 的帮助。
  • 那是……一个奇怪的。不确定。通过at CRAN as well.
  • 其他 Linux 机器上也没有。我经常安装 Rfast,因为它是 Rcpp 的反向依赖,所以我也检查一下。这个问题很可能是你的 Linux 计算机的本地问题——在编译器或其他东西之间混合。所以有理由偶然发现 DATAPTR 这是一个 C 宏。你确实可以通过builder.r-hub.io访问其他Linux机器。

标签: r rcpp rcpp11


【解决方案1】:

我在运行 Ubuntu 16.04 的台式机和笔记本电脑上遇到了完全相同的错误,不知道如何解决这个问题。

对我来说,这似乎是一种糟糕的编码习惯(在没有事先声明的情况下使用 DATAPTR(x) 函数)。我试图在头文件中找到 DATAPTR 的声明,但没有找到。

DATAPTR(x)定义在/usr/share/R/include/Rinternals.h中,Norm.cpp中没有明确包含,而Diag.cpp中包含,后者编译没有错误。

我不知道为什么这会在其他机器上编译而只在我们的机器上失败。 g++版本为:

g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609

如果Rinternals.h 没有在需要 DATAPTR 的地方显式包含,那么它应该在所有安装中都失败,除非有办法指示编译器默认包含 Rinternals.h

【讨论】:

  • 我也尝试将Rinternals.h 包含在Norm.cpp 中,但再次编译时没有任何变化。
  • 我也在另一个 ubuntu 16.04 系统上尝试过,结果相同。然后我在一个arch linux系统上试了一下,一切都按预期工作。关于如何识别这两个系统之间的编译差异的任何想法?
  • 我不知道。我怀疑这是与需要声明的订单函数有关的 C++ 事情。仅仅包括Rinternals.h 也没有为我解决这个问题。我想我们需要等到更多 Ubuntu 用户报告这一点。
【解决方案2】:

我认为问题是我忘记添加了

#include <Rinlinedfuns.h>

但是我不能使用这个文件。 DATAPTR 在此文件中声明。

【讨论】:

  • 有人查吗?
  • 请注意,对于 R >= 3.5.0,DATAPTR 被定义为内联函数。即使没有函数声明,这也有效。在此之前,DATAPTR 是一个宏。并且该宏的定义对于编译是绝对必要的。
  • @RalfStubner:你是对的。在我尝试过的 Arch Linux 中,我有 R 版本 3.5.1,而在 ubuntu 上它是 3.4.4。现在有哪些选择?我应该在 Ubuntu 中安装 3.5.1 还是有其他解决方案?
  • @J.Doe 我会选择 R 3.5.1。或者,您可以手动路径 template.h 直到官方 Rfast 修复。
  • @RalfStubner:对不起,'手动路径 template.h' 是什么意思?
猜你喜欢
  • 2017-05-17
  • 2020-11-24
  • 2018-01-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-02-27
  • 2022-07-14
相关资源
最近更新 更多