在Ubuntu 18.04LTS上的R中安装OpenMx软件包

时间:2019-01-20 19:09:26

标签: r gcc g++ ubuntu-18.04 openmx

在Ubuntu 18.04上的R中尝试安装(install.packages("OpenMx"))OpenMx时出现以下错误。我对编译C代码不熟悉,所以请您稍微帮我一下。

Installing package into ‘/home/adam/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/OpenMx_2.12.1.tar.gz'
Content type 'application/x-gzip' length 3338967 bytes (3.2 MB)
==================================================
downloaded 3.2 MB

* installing *source* package ‘OpenMx’ ...
** package ‘OpenMx’ successfully unpacked and MD5 sums checked
NOTE: ./configure is not an autoconf generated script.
Change default C/C++ compiler and default compile flags by editing ~/.R/Makevars
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include" -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.5/RcppEigen/include" -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.5/StanHeaders/include" -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.5/BH/include" -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.5/rpf/include"   -fopenmp     -I. -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-i39faS/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c Compute.cpp -o Compute.o
In file included from omxState.h:31:0,
                 from glue.h:23,
                 from Compute.cpp:24:
omxDefines.h:247:10: fatal error: Eigen/Core: No such file or directory
 #include <Eigen/Core>
          ^~~~~~~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:171: recipe for target 'Compute.o' failed
make: *** [Compute.o] Error 1
ERROR: compilation failed for package ‘OpenMx’
* removing ‘/home/adam/R/x86_64-pc-linux-gnu-library/3.5/OpenMx’
* restoring previous ‘/home/adam/R/x86_64-pc-linux-gnu-library/3.5/OpenMx’
Warning in install.packages :
  installation of package ‘OpenMx’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpbljrRR/downloaded_packages’

更新1

似乎错误可能是由于未安装RcppEigen软件包导致的。当我尝试安装软件包时,我收到10,000行错误消息。这是第一个:

g++  -I"/usr/share/R/include" -DNDEBUG  -I"/home/adam/R/x86_64-pc-linux-gnu-library/3.5/Rcpp/include"   -I../inst/include -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-i39faS/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppEigen.cpp -o RcppEigen.o
In file included from ../inst/include/Eigen/Core:392:0,
                 from ../inst/include/Eigen/Dense:1,
                 from ../inst/include/RcppEigenForward.h:30,
                 from ../inst/include/RcppEigen.h:25,
                 from RcppEigen.cpp:22:
../inst/include/Eigen/src/Core/arch/SSE/PacketMath.h:60:39: warning: ignoring attributes on template argument ‘__m128 {aka __vector(4) float}’ [-Wignored-attributes]
 template<> struct is_arithmetic<__m128>  { enum { value = true }; };

更新2

我成功安装了RcppEigen,但是OpenMx仍然无法编译。 only 错误位于非常长(数千行)的编译警告流的末尾。错误:ERROR: compilation failed for package 'OpenMx'

1 个答案:

答案 0 :(得分:1)

这里有些错误,并且仅显示部分输出也无济于事。

对于初学者来说,package clearly depends on other binary packages是可以的,但是您没有告诉我们是否已安装。 如果您先前有错误,但没有显示,那么简单地说,您就没有安装OpenMX的机会。

因此,我将执行以下操作:确保安装了Imports:LinkingTo:上方和下方的链接中的 all 个软件包。通过例如library(Rcpp)逐个加载R来进行测试。

如果满足所有要求,则尝试安装OpenMX,并更新您的问题和相关错误消息(如果有)。但简而言之,以上关于libeigen3-dev软件包的评论完全是误导性的,因为RcppEigen不使用该软件包。

最后,r-sig-debian列表友好而耐心,是Debian / Ubuntu问题的发源地。

编辑:根据OP的编辑,一种快捷方式可能是sudo apt-get install r-cran-rcppeigen