8

I'm trying to install the R package rgl on Ubuntu 9.10. I'm using R version 2.12.1.

I got the following error: "configure: error: missing required header GL/gl.h"

Edit: My original question did not specify that the operating system must be Ubuntu 9.10. I gather that otherwise it would be a good idea to update R, but that this cannot be done on Ubuntu 9.10. Because I'm stupid, I posted a new question instead of editing this one, so some discussion has occurred there.

Community
  • 1
  • 1
BenH
  • 2,100
  • 2
  • 22
  • 33
  • You don't say which GNU/Linux distribution you are using. 1) update R and 2) if this is Debian or Ubuntu then install the binary kindly built for you already (apt-get install r-cran-rgl). Check out the README on CRAN. – G. Jay Kerns Sep 19 '11 at 16:39
  • @G.JayKerns As I am not a computer-savvy person, I am stuck on step 1: update R. I've been scouring the internet for step-by-step instructions (for dummies), but everything I find seems to assume that I'm a competent Linux user. – BenH Sep 19 '11 at 18:52
  • It's OK to not be saavy, but you need to help us help you - in particular, we still don't know what distribution you're using. Are you on Ubuntu? If so, start here: http://cran.case.edu/bin/linux/ubuntu/ Then there are fora galore, and there's Rseek.org for google searches of R related material. – G. Jay Kerns Sep 19 '11 at 19:19
  • I'm on Ubuntu 9.10, the Karmic Koala. I followed the instructions on that page, but it didn't upgrade R; I still have version 2.12.1. I don't see that Rseek.org is giving different results than Google is; in particular it leads me back to the page you mentioned and the R manual. – BenH Sep 19 '11 at 20:10
  • Alright, now we are getting somewhere. It looks like 9.10 isn't supported (by the folks at CRAN), so your next steps include 1) upgrade your Ubuntu or 2) try to get the older version of R+rgl to work for you with 9.10. At this point, if you elect option 2) then you are going to get better advice from somebody other than me. – G. Jay Kerns Sep 19 '11 at 20:29

3 Answers3

15

I had to deal with this problem many times, and this always worked just fine: type in a terminal

sudo apt-get install libglu1-mesa-dev

After this I just start R and install the rgl package with the install.packages function

Juan
  • 1,351
  • 1
  • 14
  • 28
8

In case any newbies like myself have the same or similar issues installing rgl, the following finally worked for me.

1) At the bash prompt:

sudo apt-get build-dep r-cran-rgl

This fixes "missing required header GL/gl.h" issues (I still had one after installing libglu1-mesa-dev).

2) At the R prompt (I started R with 'sudo R' but that probably isn't required):

install.packages("rgl", repos="http://R-Forge.R-project.org")

which downloads, compiles, and installs the latest version.

I also tried sudo apt-get install r-cran-rgl at step 2), but whenever I tried library(rgl) within R it would complain with

Error: package ‘rgl’ was built before R 3.0.0: please re-install it

But rgl can be upgraded from this point using the update.packages() command in R. This might be preferable if you want apt-get to know it's installed, but I didn't really care since R provides it's own package-management tools.

flyingfinger
  • 690
  • 12
  • 16
2

You probably need to be doing this with R 2.13.1. The linking points are probably different. If you really insist on using an old version, you need to compile with a version of rgl that matches that version. There is an Archive of prior versions and the link is at the bottom of the Contributed Packages page at the CRAN website.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • I can't figure out how to update R. All the instructions I've been able to find say things like "To ensure that the installed tree is usable by the right group of users, set umask appropriately (perhaps to ‘022’) before unpacking the sources and throughout the build process", and I don't have any idea what this means. – BenH Sep 19 '11 at 17:36
  • Specific advice varies with which Linux kernel you are targeting. I don't think I am going to be a lot of help on point that since the Mac is a BSD Unix device and is use the packages provided by Simon Urbanek at the ATT.research.com site. The R Installation and Administration manual has general "UNIX-alike" and more narrow Linux focused sections and if you happen to be using a Debian branch there is a mailing list: https://stat.ethz.ch/mailman/listinfo/r-sig-debian – IRTFM Sep 19 '11 at 18:41
  • Ok, well thanks for the help, it's pointing me in the right direction. I find the R Installation and Administration manual incomprehensible though (that's what the quote above is from). I'm just trying to do some math, and I'm not adept at getting Linux to do what I want. – BenH Sep 19 '11 at 18:49