rmacosgithubrglpackage-development

Installing rgl package in R Mac OS via R-CMD-check


One of the dependencies of my package is the rgl package. When I try to do a R-CMD-check via Github Actions with the config

- {os: macOS-latest, r: 'release'}

as set up via

usethis::use_github_action_check_standard()

I am running into a problem with the rgl package (there is no problem for windows). The exact error message is:

Error in dyn.load(dynlib <- getDynlib(dir)) : 
  unable to load shared object '/Users/runner/work/_temp/Library/rgl/libs/rgl.so':
  dlopen(/Users/runner/work/_temp/Library/rgl/libs/rgl.so, 6): Library not loaded: /opt/X11/lib/libGLU.1.dylib
  Referenced from: /Users/runner/work/_temp/Library/rgl/libs/rgl.so
  Reason: image not found
Warning: Warning:   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
Warning: Warning: Trying without OpenGL...
ERROR: lazy loading failed for package ‘mzRAPP’
* removing ‘/private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/Rtmptc3xyB/Rinstc214f95c76f/mzRAPP’
      -----------------------------------
ERROR: package installation failed
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.

This has already be reported together with different solutions in Installing "rgl" package in R, Mac OSX El Captian and Package rgl in R not loading in Mac OS. However, I don't see how I could adapt those solutions for Githubs Actions R-CMD-check. Does anyone have an idea how this could be done?


Solution

  • The solution was to set RGL_USE_NULL: true in the env: section,.. thanks to @user2554330 (Package rgl in R not loading in Mac OS)