Installation of package ‘rgl’ had non-zero exit status
<p>I'm running R in Centos 6. I needed to remove some packages in R. After doing so and trying to reinstall, I was told that the rgl package needed to be installed. Now when I try to install it, I get the following error. </p>

<pre><code>install.packages("rgl")
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
also installing the dependencies ‘sourcetools’, ‘shiny’

trying URL 'http://cran.rstudio.com/src/contrib/sourcetools_0.1.2.tar.gz'
Content type 'application/x-gzip' length 16227 bytes (15 KB)
==================================================
downloaded 15 KB

trying URL 'http://cran.rstudio.com/src/contrib/shiny_0.14.tar.gz'
Content type 'application/x-gzip' length 2110934 bytes (2.0 MB)
==================================================
downloaded 2.0 MB

trying URL 'http://cran.rstudio.com/src/contrib/rgl_0.96.0.tar.gz'
Content type 'application/x-gzip' length 2489778 bytes (2.4 MB)
==================================================
downloaded 2.4 MB

* installing *source* package ‘sourcetools’ ...
** package ‘sourcetools’ successfully unpacked and MD5 sums checked
** libs
g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Reader.cpp -o Reader.o
g++ -m64 -std=c++0x -I/usr/include/R -DNDEBUG -I../inst/include -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c Tokenizer.cpp -o Tokenizer.o
In file included from ../inst/include/sourcetools/cursor/TokenCursor.h:7,
                 from ../inst/include/sourcetools/cursor/cursor.h:5,
                 from ../inst/include/sourcetools.h:11,
                 from Tokenizer.cpp:1:
../inst/include/sourcetools/tokenization/Token.h: In constructor ‘sourcetools::tokens::Token::Token()’:
../inst/include/sourcetools/tokenization/Token.h:27: error: ‘nullptr’ was not declared in this scope
../inst/include/sourcetools/tokenization/Token.h: In constructor ‘sourcetools::tokens::Token::Token(sourcetools::tokens::TokenType)’:
../inst/include/sourcetools/tokenization/Token.h:34: error: ‘nullptr’ was not declared in this scope
../inst/include/sourcetools/tokenization/Token.h: In constructor ‘sourcetools::tokens::Token::Token(const sourcetools::tokens::Token::Position&amp;)’:
../inst/include/sourcetools/tokenization/Token.h:41: error: ‘nullptr’ was not declared in this scope
../inst/include/sourcetools/tokenization/Token.h: In function ‘std::ostream&amp; sourcetools::operator&lt;&lt;(std::ostream&amp;, const std::vector&lt;sourcetools::tokens::Token, std::allocator&lt;sourcetools::tokens::Token&gt; &gt;&amp;)’:
../inst/include/sourcetools/tokenization/Token.h:457: error: expected initializer before ‘:’ token
../inst/include/sourcetools/tokenization/Token.h:459: error: expected primary-expression before ‘return’
../inst/include/sourcetools/tokenization/Token.h:459: error: expected ‘;’ before ‘return’
../inst/include/sourcetools/tokenization/Token.h:459: error: expected primary-expression before ‘return’
../inst/include/sourcetools/tokenization/Token.h:459: error: expected ‘)’ before ‘return’
In file included from ../inst/include/sourcetools/cursor/cursor.h:5,
                 from ../inst/include/sourcetools.h:11,
                 from Tokenizer.cpp:1:
../inst/include/sourcetools/cursor/TokenCursor.h: In member function ‘bool sourcetools::cursors::TokenCursor::moveToPosition(const sourcetools::cursors::TokenCursor::Position&amp;)’:
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before ‘[’ token
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before ‘]’ token
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before ‘const’
../inst/include/sourcetools/cursor/TokenCursor.h:167: error: expected primary-expression before ‘const’
make: *** [Tokenizer.o] Error 1
ERROR: compilation failed for package ‘sourcetools’
* removing ‘/usr/lib64/R/library/sourcetools’
Warning in install.packages :
  installation of package ‘sourcetools’ had non-zero exit status
ERROR: dependency ‘sourcetools’ is not available for package ‘shiny’
* removing ‘/usr/lib64/R/library/shiny’
Warning in install.packages :
  installation of package ‘shiny’ had non-zero exit status
ERROR: dependency ‘shiny’ is not available for package ‘rgl’
* removing ‘/usr/lib64/R/library/rgl’
Warning in install.packages :
  installation of package ‘rgl’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpdNMaV6/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
</code></pre>

<p>I've followed the advice on a similar question, and tried to reinstall the following</p>

<pre><code>sudo yum install mesa-libGL mesa-libGL-devel mesa-libGLU mesa-libGLU-devel
sudo yum groupinstall X11
</code></pre>

<p>This has had no effect though. Indeed, I didn't think it would have, as there is nothing in my error message about missing libraries that I can see (the other inter-dependent R libraries aside, which I've already tried to install separately).  </p>