53

I am trying to install the package mvoutlier but following error occurs during installation:

install.packages("mvoutlier")
configure: error: missing required header GL/gl.h 
ERROR: configuration failed for package ‘rgl’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library /2.15/rgl’
ERROR: dependency ‘rgl’ is not available for package ‘compositions’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/compositions’
ERROR: dependency ‘compositions’ is not available for package ‘mvoutlier’
* removing ‘/home/sam/R/x86_64-pc-linux-gnu-library/2.15/mvoutlier’

After that I have install the rgl package successfully, then I tried to install the compositions package then the again same error occurs. Then I have again tried to install the mvoutlier package the same error occurs.

Can anyone let me know how I can resolve this problem. Thanking you in advance.

6
  • what errors showed up when installing compositions? After installing rgl the exact same errors appeared?
    – EDi
    Commented Mar 8, 2013 at 11:37
  • Do you get the same error with install.packages("compositions" , dependencies = TRUE )? Commented Mar 8, 2013 at 11:37
  • The error seems to be in rgl package, try to update it first: update.packages(oldPkgs="rgl") Commented Mar 8, 2013 at 11:39
  • @Hemmo I have installed updated version, though these error occurs
    – Saurabh
    Commented Mar 8, 2013 at 12:01
  • @SimonO101 I have also tried like this but the errors are same.
    – Saurabh
    Commented Mar 8, 2013 at 12:02

8 Answers 8

52

I suspect you are running Ubuntu 12.04.I think you're going to find that this works for the GL/gl.h problem:

install these at the regular old terminal, ie pretend R doesn't exist for now:

libglu1-mesa-dev freeglut3-dev mesa-common-dev

You might get the following error later (in R) because of a tcl b****/gripe/complaint:

Error in structure(.External(.C_dotTcl, ...), class = "tclObj") : 
  [tcl] can't find package BWidget.

To fix this problem, if you have it:

sudo apt-get install bwidget

These are not R problems. They are OS problems!

4
  • The following worked for me (Linux Mint 17.2): apt-get install libx11-dev apt-get install mesa-common-dev mesa-common-dev: /usr/include/GL/gl.h dpkg -S /usr/include/GL/gl.h apt-get install libglu1-mesa-dev
    – noumenal
    Commented Aug 8, 2015 at 10:19
  • 7
    sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev solved this problem for me on Ubuntu 15.10. Thank you! Commented Nov 18, 2015 at 13:02
  • The accepted answer did not work for me (Ubuntu 16.04), but this one did the trick. Thanks.
    – Azim
    Commented Jun 11, 2018 at 17:29
  • for my debian I also add to install: sudo apt-get install libfreetype6-dev because after installing all the packages listed above I still had fatal error: ft2build.h: No such file or directory
    – Simon C.
    Commented Dec 23, 2019 at 1:45
41

I ran into the same issue in between others on a Ubuntu based Linux distro (Linux Mint). Here I will share the worklog I'd done to fix it.

The full fix was:

apt-get install libx11-dev mesa-common-dev libglu1-mesa-dev

Worklog

The first error was related to missing devel libraries of X11:

configure: error: X11 not found but required, configure aborted.

I fixed it installing:

apt-get install libx11-dev

However, after fix the issue, I felt into a new one like this one:

configure: error: missing required header GL/gl.h ERROR: configuration failed for package ‘rgl’

I checked the library on the repository:

# dpkg -S /usr/include/GL/gl.h dpkg-query: no path found matching pattern /usr/include/GL/gl.h

To fix this issue, install :

apt-get install mesa-common-dev

Then, I was prompt by a new error:

configure: error: missing required header GL/glu.h

To fix the issue, install the libglu1 devel libraries:

apt-get install libglu1-mesa-dev

37
configure: error: missing required header GL/gl.h 

normally means you haven't installed the -dev version of a package, in this case GL.

On my system, GL/gl.h is owned by mesa-common-dev

$ dpkg -S /usr/include/GL/gl.h
mesa-common-dev: /usr/include/GL/gl.h

which would have been installed with apt-get install mesa-common-dev or via some GUI magic.

4
  • Thanks a lot :) I did the same and finally able to install the required package.
    – Saurabh
    Commented Mar 8, 2013 at 12:10
  • Hi I'm new to ubuntu environment. I encountered the same issue and I tried executing the above commands. But didn't work for me. Do I need administrative privileges to execute these commands?
    – SriniShine
    Commented Aug 13, 2015 at 15:35
  • 3
    For users of the RHEL family of distros dnf install mesa* does the trick.
    – nothing
    Commented May 2, 2016 at 21:58
  • Thank you Richard! this solved my problem in fedora :)
    – m0000g
    Commented Aug 27, 2016 at 20:30
19

On Ubuntu 16.04, I solved this problem (during rgl package installation) with sudo apt-get install libglu1-mesa-dev

3
  • 1
    Worked for me as well on Mint 18.2 (based on Ubuntu 16.04). Commented Apr 23, 2018 at 5:13
  • still working as only required line in ubuntu 19.10
    – dez93_2000
    Commented Nov 22, 2019 at 17:56
  • Worked for me (ubuntu 20)
    – igorkf
    Commented Sep 20, 2020 at 1:29
7

the current fedora package manager will fail to find these libraries as shown. Instead you need to do

    sudo dnf install mesa-libGL-devel mesa-libGLU-devel
0
3

Based on the work breakdown by 3manuek, I figured only the libglu1-mesa-dev library was needed in ubuntu 16.04 LTS, and it worked.

1

On, RHEL, sudo yum install mesa-libGLU-devel worked.

0

I encountered an equivalent problem when testing a package that required 'rgl' on Travis. The problem is that the operating system lacks the necessary GL files on which the 'rgl' package draws.

A thread at R-forge offers the ingenious solution of running apt-get install r-cran-rgl, which will pull in any of the GL dependencies not already present on the operating system. This seems simpler than second-guessing which specific dependency is missing, and it remains possible to install a more recent version of 'rgl' if required.

Not the answer you're looking for? Browse other questions tagged or ask your own question.