7

I have been trying to install the rgl package in my macOS Big Sur, but I have failed each time.

I have downloaded R from the CRAN website, and have also installed Xquartz. After rebooting the computer, I tried to install the rgl package from the R console. It installs successfully, but whenever I type library("rgl") in the R console, the package does not load, and instead, this is shown :

    Error in dyn.load(dynlib <- getDynlib(dir)) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so':
  dlopen(/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so, 6): Symbol not found: _hb_buffer_add_utf8
  Referenced from: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so
  Expected in: flat namespace
 in /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/rgl/libs/rgl.so
Error: package or namespace load failed for ‘rgl’:
 .onLoad failed in loadNamespace() for 'rgl', details:
  call: rgl.init(initValue, onlyNULL)
  error: OpenGL is not available in this build
In addition: Warning messages:
1:  Loading rgl's DLL failed. 
    This build of rgl depends on XQuartz, which failed to load.
 See the discussion in https://stackoverflow.com/a/66127391/2554330 
2: Trying without OpenGL... 

I headed to the link that this error message mentions, and tried uninstalling rgl and Xquartz, and reinstalling them again, but the issue remains.

Moreover, here it is said that I am supposed to delete org.xquartz.startx.plist from /Library/LaunchDaemons, but from the terminal, after navigating to the Library directory, it seems that there is nothing named LaunchDaemons or LaunchAgents.

Any help would be appreciated. I am using macOS Big Sur 11.4, Xquartz 2.8.1 and rgl 0.106.8. Thanks.

Souvik Roy
  • 71
  • 3
  • 4
    Try running `options(rgl.useNULL=TRUE)` before `library(rgl)`. This will stop rgl from displaying in XQuartz windows; you can still display in a browser (or RStudio) by calling `rglwidget()`. – user2554330 Jul 26 '21 at 01:34
  • 1
    Thanks for the information. I tried that, and that stopped rgl from displaying the message that it depends on `Xquartz` which failed to load. But I was still struggling to get the 3d plots displayed, until I came across this option to update all pre installed packages on VSCode (I use VSCode for R). On updating the packages, this issue magically resolved on its own. Now, it works normally. Thanks for the help though. – Souvik Roy Jul 26 '21 at 16:50

0 Answers0