Installing rgl on Ubuntu and Mac: X11 not found

岁酱吖の 提交于 2019-11-27 03:53:34

On a clean 16.04 Ubuntu install (and apparently for 18.04 according to the commments below), you might get this issue when trying to install rgl from CRAN:

checking for X... no configure: error: X11 not found but required, configure aborted.

ERROR: configuration failed for package ‘rgl’

Credit is due to this blog which solved my problems at installing rgl:

http://solaimurugan.blogspot.ca/2015/09/3d-data-visualization-using-r-configure.html

In case the link above disappears, the solution, as outlined in the blog is:

sudo apt-get install xorg 
sudo apt-get install libx11-dev 
sudo apt-get install libglu1-mesa-dev 

More recently, installing rgl on a fresh ubuntu 16.04 install also requires a further step (as noted in the comments below), if you get this error:

fatal error: ft2build.h: No such file or directory

This is solved with:

sudo apt-get install libfreetype6-dev

Then installing rgl from CRAN should just work.

On Ubuntu, what worked for me was to install the package directly from the command line:

sudo apt-get install r-cran-rgl

(We have a strange setup here, so YMMV)

All the mentioned answers are correct; however, none is for Mac.

In my case (I am a Mac user), I solved the problem by installing XQuartz and restarting R.

On CentOS, what finally did the trick was installing libpng-dev:

sudo yum install libpng-devel.x86_64

Prior to this, I installed xorg, libx11, the mesa GL library, and freeglut.

sudo yum install xorg-x11-server-Xvfb.x86_64 xorg-x11-server-devel.x86_64 
sudo yum install libX11.x86_64 libX11-devel.x86_64
sudo yum install mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel
sudo yum install freeglut.x86_64 freeglut-devel.x86_64

The way I finally figured out what was missing was to try compiling from source (download the tar.gz at cran), and examining the config.log after ./configure failed.

HassanSh__3571619

Not sure about Mac case but on Windows I faced issues downloading the same rgl Package. Installing the RGL requires the devtools package

install.packages("devtools")
library(devtools)
install.packages("rgl")
library(rgl)

Took me a long time to figure this out on the [RHEL 3.10.0-862.14.4.el7.x86_64 x86_64 x86_64 x86_64 GNU/Linux]. The following packages are required:

libpng12-devel.x86_64
ImageMagick-c++-devel.x86_64
mesa-libGLU-devel.x86_64
libselinux-devel.x86_64
xorg-x11-apps

On OpenSuse

sudo zypper install xorg-x11-devel
sudo zypper install glu-devel
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!