How to fix a tcltk error on R CMD check for macos

77 views Asked by At

I'm getting the following error on a Github Action R CMD check for Mac OS. Other OSs give no errors. Strangely, my package does not use tcltk at all. I can't figure out how to fix the package to avoid the problem, and CRAN won't let me upload with this problem.

── Install failure ─────────────────────────────────────────────────────────────

* installing *source* package ‘weird’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
tcltk DLL is linked to '/opt/X11/lib/libX11.6.dylib'
Error: Error: .onLoad failed in loadNamespace() for 'tcltk', details:
  call: fun(libname, pkgname)
  error: X11 library is missing: install XQuartz from www.xquartz.org
Execution halted
ERROR: lazy loading failed for package ‘weird’
* removing ‘/Users/runner/work/weird-package/weird-package/check/weird.Rcheck/weird’

1 error ✖ | 0 warnings ✔ | 0 notes ✔
Error: Process completed with exit code 1.

I know I can fix the problem on Github Action by adding

- name: Install XQuartz on macOS
  if: runner.os == 'macOS'
  run: brew install xquartz --cask

to the yaml, but that only avoids the problem on Github. The problem is still there when I submit to CRAN.

1

There are 1 answers

0
Rob Hyndman On

For the record, in case anyone has the same problem.

It turns out that the CRAN macos machine was missing the Tcl/Tk libraries and any package needing them was causing errors. So the problem was CRAN's, not mine.

The GitHub Actions fix is simply to add xquartz to the yaml:

- name: Install XQuartz on macOS
  if: runner.os == 'macOS'
  run: brew install xquartz --cask