问题
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.
回答1:
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
回答2:
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.
回答3:
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.
来源:https://stackoverflow.com/questions/7473067/how-do-i-install-the-r-package-rgl-on-ubuntu-9-10-using-r-version-2-12-1