22

I am trying to install rgl package (0.92.858) for R (2.14.2) under Mac OS X (Lion 10.7.3). When I try to load it (library(rgl)), I get the following error:

  Error : .onLoad failed in loadNamespace() for 'rgl', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so, 6): Symbol not found: __ZN3gui13OSXGUIFactory12hasEventLoopEv
  Referenced from: /Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so
  Expected in: dynamic lookup

I have a Mac with Norwegian keyboard. Maybe this has something to do with the issue? However, I get the same error, even though I change the language to U.S. Has anyone experienced similar problem? Any way solving it?

smci
  • 32,567
  • 20
  • 113
  • 146
Mikko
  • 7,530
  • 8
  • 55
  • 92
  • How did you try to install rgl? ... code used? ...repo?, ...source or binary? – IRTFM Mar 26 '12 at 19:56
  • 2
    OOOOPPS. I just updated to that version (as binary from http://cran.fhcrc.org) whereas an earlier version ran without problems this morning. After restarting I get the same error. – IRTFM Mar 26 '12 at 20:02
  • Uh, "good" to hear that this is not an unique problem. Maybe we'll find a solution for this. I installed with code (install.packages("rgl")). Another theory is that it could be X11 that causes the problems. However, it seems to work otherwise. – Mikko Mar 26 '12 at 20:28
  • Interesting. `rgl 0.92.858` from CRAN on `R 2.14.2; universal-apple-darwin9.8.0` works fine for me. I don't think your keyboard is an issue there. – chl Mar 26 '12 at 20:32
  • I've seen a few people get a similar error and installing from source after installing the dependancies seemed to do the trick. – Hansi Mar 26 '12 at 21:59
  • Huh. I'm on 10.7.3 with 2.14.1 and rgl 0.92.858 and I can't replicate this installing from CRAN. I do have XQuartz 2.7.2. – Adam Hyland Mar 27 '12 at 03:50
  • Hansi, I get following error message, when installing from source: configure: error: in `/private/var/folders/zz/05ksfqx947sf_r5bmxjlvkkc0000gn/T/RtmpX7DezH/R.INSTALL28f7f6a744e/rgl': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details ERROR: configuration failed for package ‘rgl’ – Mikko Mar 27 '12 at 08:35
  • Adam Hyland: I installed XQuartz 2.7.2_beta3 from the internet. The issue is not fixed. x11() command opens the "old" X11 (XQuartz 2.6.3) that was installed already. – Mikko Mar 27 '12 at 09:40
  • In case it is of interest, I found this (maybe related) thread on r-sig-mac today, https://stat.ethz.ch/pipermail/r-sig-mac/2012-March/009125.html. – chl Mar 28 '12 at 17:29
  • Okay, I just tried the standard `install.packages("rgl") on my laptop, which is instead running OS X 10.7, and it installed fine. Looks like Apple might be forcing me to finally upgrade my Mac Pro to Lion... – Paul 'Joey' McMurdie Apr 27 '12 at 20:00
  • @Paul McMurdie: Have you tried updating X11? – Mikko Apr 30 '12 at 18:48
  • @Largh : No, I hadn't tried that, though, wouldn't that be included in the OS "Software Update" utility? If so, then I'm sure it's up to date. I'd post a version number here to be precise, but I'm in the process of updating to OS X Lion right now 0:) – Paul 'Joey' McMurdie Apr 30 '12 at 20:07

7 Answers7

19

I was having this problem with rgl 0.93.996 on OSX 10.9.2, but then after reinstalling several times I saw "Installing rgl - error: X11 not found but required, configure aborted"

A quick search took me here https://stat.ethz.ch/pipermail/r-sig-mac/2012-March/009077.html

Then I was finally able to get it to work by downloading XQuartz https://www.xquartz.org So it was X11 that was the problem in my case.

Sheriseology
  • 324
  • 2
  • 5
8

It requires building from the source as there is a problem with the path to libpng.dylib path if using the built in source install. The process is:

1) Download the source files from http://download.r-forge.r-project.org/src/contrib/rgl_0.92.879.tar.gz - You need to download the source files from here since you have to manually install the program.

2) Unzip the files to a convenient location. You can do this by double clicking on the .tar file

3) Open Terminal and navigate to the directory that you placed the files in. I put them on my desktop so the command is:

cd ~/Desktop

4) In Terminal run

R CMD INSTALL --with-libpng-prefix=/usr/X11/lib/ rgl

You can then delete all the files you downloaded. Note that I am running Mac OS X 10.7.3 with R 2.15.0. The specific paths may be slightly different if you are on a different version. You do not need the rgl folder or files after you install them and they can be deleted.

statuser
  • 89
  • 2
  • After trying this, I still have the same/similar issue on R 2.15.0 on Max OS X 10.6.8: ```checking for glEnd in -lGL... no configure: error: missing required library GL ERROR: configuration failed for package ‘rgl’ ``` – Paul 'Joey' McMurdie Apr 27 '12 at 19:45
  • @statuser: If you believe there is a problem with the binary install or the default source install with later versions, then please contact the maintainer with details. – IRTFM May 02 '12 at 22:39
  • The updated url is: http://download.r-forge.r-project.org/src/contrib/. Search for rgl because the files are sorted by case! – B Seven Jan 08 '16 at 23:39
  • Please, fix the link to `tar.gz`: it is writing `not found` – Nikita Vlasenko Nov 02 '18 at 23:51
3

I was still having issues installing from source with special flags or any of the other suggestions in comments and things above. I am using Mac OS X 10.7.3 on a 64-bit MacBook Pro and R 2.15.0

I continued to get the following when loading the rgl package: error: unable to load shared object '/Library/Frameworks/R.framework/Versions/2.14/Resources/library/rgl/libs/x86_64/aglrgl.so'

I tried the following sub-optimal solution works: Delete the aglrgl.so file. Then try loading the package again. (This is a suggestion I took from a post by Duncan Murdoch )

A quick way to delete this file is to type the following into the terminal: open -a Finder /Library/Frameworks/R.framework/Versions/2.15/Resources/library/rgl/libs/x86_64/

In the new Finder window that pops up, delete the aglrgl.so file, and then close the window. Open the R-GUI, and try loading rgl: library("rgl"). It should work fine, and unfortunately use X11 for the 3D graphics instead of the native Quartz window. For me, this is better than nothing.

Paul 'Joey' McMurdie
  • 7,295
  • 5
  • 37
  • 41
  • Mmh..it seems that this problem is reoccurring now and then. I don't have an access to a mac at the moment, so can't check whether the new version of rgl would work or not. In addition to the solution you suggest downgrading the R version or using the external X11 has worked for some mac users (at least what I have heard). I'll untick the "question accepted". If you'll find a final solution for this problem, please tell and I can accept that answer. – Mikko May 01 '12 at 14:57
  • I'm not on R-Forge, but someone should probably post a bug [at the rgl development page](http://r-forge.r-project.org/projects/rgl). This build issue seems distinct from a separate outstanding build issue on linux machines, also [listed on their bug report page](http://r-forge.r-project.org/tracker/index.php?func=detail&aid=1939&group_id=234&atid=946). – Paul 'Joey' McMurdie May 01 '12 at 22:02
  • same error pops up on R 3.0.1 and rgl_0.93.940 except there is no `aglrgl.so` to delete when i searched for it – pyCthon May 19 '13 at 03:37
2

The problem is now documented on R-forge : http://r-forge.r-project.org/tracker/index.php?func=detail&aid=1996&group_id=234&atid=946

You basically have to delete the incriminated file, aglrgl.so. R gives you the file's path in the displayed error message.

Kamixave
  • 265
  • 1
  • 2
  • 8
1

The new Mac binary version of rgl 0.92.861 installs on 2.14.2 without error and runs the example code.

IRTFM
  • 258,963
  • 21
  • 364
  • 487
  • 1
    rgl (0.92.861) seems to work under R 2.15.0 too. So if you encounter this problem, just update your R. – Mikko Apr 03 '12 at 08:34
0

Okay solution in my case (OS X Yosemite), first download the RGL source (not binaries) in http://cran.r-project.org/src/contrib/rgl_0.95.1247.tar.gz, extract it, and build the library using this command:
R CMD INSTALL --disable-cocoa --x-includes=/usr/X11/ rgl
and it works like a charm.

faisal_w
  • 21
  • 6
0

I got this error:

> library(bios2mds)
Error in dyn.load(dynlib <- getDynlib(dir)) :
  unable to load shared object '/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/4.2/Resources/library/rgl/libs/rgl.so
  Reason: Incompatible library version: rgl.so requires version 5.0.0 or later, but libGLU.1.dylib provides version 1.3.0

But I just needed to update the rgl package by running install.packages(rgl).

nisetama
  • 7,764
  • 1
  • 34
  • 21