【问题标题】:How to install R "rgl" package under centos 6?centos 6下如何安装R“rgl”包?
【发布时间】:2016-02-04 09:41:17
【问题描述】:

我有下面的环境, CentOS 6.4 版,R 3.2.2 版。

我想为 R 安装“rgl”包。 一开始我用install.packages("rgl"),下面报错:

 Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://mirror.bjtu.edu.cn/cran/src/contrib/rgl_0.95.1367.tar.gz'
Content type 'application/octet-stream' length 2033202 bytes (1.9 MB)
==================================================
downloaded 1.9 MB

* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for gcc... (cached) gcc -m64 -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -m64 -std=gnu99 accepts -g... (cached) yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... (cached) none needed
checking whether __attribute__((visibility())) is supported... yes
checking whether gcc -m64 -std=gnu99 accepts -fvisibility... yes
checking whether  accepts -fvisibility... no
checking for libpng-config... no
checking libpng... checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
checking for png_read_update_info in -lpng... no
configure: libpng header and lib found
configure: using libpng dynamic linkage
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ‘rgl’
* removing ‘/usr/lib64/R/library/rgl’

The downloaded source packages are in
    ‘/tmp/Rtmp6mou8m/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("rgl") :
  installation of package ‘rgl’ had non-zero exit status

然后我尝试使用 R CMD 安装“rgl”包。我从http://cran.at.r-project.org/web/packages/rgl/index.html 下载了“rgl_0.95.1367.tar.gz”。我是通过R CMD INSTALL 命令安装的:

[root@srv005 RFile]# R CMD INSTALL -l rgl_0.95.1367.tar.gz 
Error: ERROR: no packages specified
[root@srv005 RFile]# R CMD INSTALL rgl_0.95.1367.tar.gz 
* installing to library ?.usr/lib64/R/library?
* installing *source* package ?.gl?....
** package ?.gl?.successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for gcc... (cached) gcc -m64 -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -m64 -std=gnu99 accepts -g... (cached) yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... (cached) none needed
checking whether __attribute__((visibility())) is supported... yes
checking whether gcc -m64 -std=gnu99 accepts -fvisibility... yes
checking whether  accepts -fvisibility... no
checking for libpng-config... no
checking libpng... checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
checking for png_read_update_info in -lpng... no
configure: libpng header and lib found
configure: using libpng dynamic linkage
checking for X... no
configure: error: X11 not found but required, configure aborted.
ERROR: configuration failed for package ?.gl?
* removing ?.usr/lib64/R/library/rgl?

它也不起作用。

有谁知道如何在 CentOS 中安装这个“rgl”软件包?还是根本无法在 CentOS 中安装该软件包?谢谢。

【问题讨论】:

  • 您需要安装 X11 库(可能还有库的开发版本),但我不知道在那个操作系统上如何:这对 centos.org/forums/viewtopic.php?t=5933 有帮助吗?
  • 你还需要 png 库。
  • 为什么我们需要 png 库?添加后似乎没有变化。 @帕斯卡
  • 写的是找不到。请阅读错误信息。无论如何,您是否还安装了 OpenGL 和 GLU 库,如此处所述:cran.r-project.org/web/packages/rgl/index.html
  • 哦,知道了。谢谢@Pascal

标签: r


【解决方案1】:

在 RHEL 上你必须安装 libX11-devel, AFAIR

sudo yum install libX11-devel

我猜在 CentOS 上也是这样。

【讨论】:

  • 你还需要 png 库。
  • 谢谢,它有效。我安装了libX11-devel,然后我成功使用了install.packages("rgl")。但是当我使用它时,有一个警告消息,library("rgl") Warning messages: 1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display 2: In fun(libname, pkgname) : Error in 'rgl_init'。网上搜了一下,有解决办法,加options(rgl.useNULL=TRUE)。我添加了它,警告消息消失了,但似乎我不能使用 3D 绘图。无论如何,您知道可以让我使用 3D 绘图吗?谢谢。
  • 你能在 rgl 之外使用 3d 加速吗?例如glxgears 工作吗?
  • 当我尝试安装glxgears时,它给了我:Warning message: package ?.lxgears?.is not available (for R version 3.2.2)
  • glxgears 似乎是glx-utils 的一部分。你安装了吗?
【解决方案2】:

我还必须安装 openGL 和 GLU 库。

sudo yum install mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel
sudo yum groupinstall X11

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-02
    • 1970-01-01
    • 1970-01-01
    • 2021-06-26
    • 2021-12-15
    • 2018-07-18
    • 1970-01-01
    相关资源
    最近更新 更多