Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in loading rgl package with Mac OS X

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?

like image 711
Mikko Avatar asked Mar 26 '12 19:03

Mikko


3 Answers

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.

like image 105
Sheriseology Avatar answered Nov 09 '22 10:11

Sheriseology


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.

like image 8
statuser Avatar answered Nov 09 '22 09:11

statuser


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.

like image 3
Paul 'Joey' McMurdie Avatar answered Nov 09 '22 10:11

Paul 'Joey' McMurdie