[R-SIG-Mac] loading tcltk fails in R 4.2.1 on macOS

332 views
Skip to first unread message

John Fox

unread,
Sep 2, 2022, 1:00:45 PM9/2/22
to r-si...@r-project.org, andreas....@lnu.se
Dear R-SIG-MAC list members,

Unless developer tools are installed, loading the standard tcltk package
fails in R 4.2.1 on macOS because of the absence of otool:

------- snip -------

> library(tcltk)
Error: package or namespace load failed for ‘tcltk’:
.onLoad failed in loadNamespace() for 'tcltk', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object
'/Library/Frameworks/R.framework/Versions/4.2/Resources/library/tcltk/libs/tcltk.so':

dlopen(/Library/Frameworks/R.framework/Versions/4.2/Resources/library/tcltk/libs/tcltk.so,
0x000A): Library not loaded: /opt/X11/lib/libX11.6.dylib
Referenced from:
/Library/Frameworks/R.framework/Versions/4.2/Resources/library/tcltk/libs/tcltk.so
Reason: tried: '/opt/X11/lib/libX11.6.dylib' (no such file),
'/usr/local/lib/libX11.6.dylib' (no such file),
'/usr/lib/libX11.6.dylib' (no such file)
In addition: Warning message:
In system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE) :
running command ''/usr/bin/otool' -L
'/Library/Frameworks/R.framework/Resources/library/tcltk/libs//tcltk.so''
had status 1
xcode-select: note: no developer tools were found at
'/Applications/Xcode.app', requesting install. Choose an option in the
dialog to download the command line developer tools.

> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
BLAS:
/Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRblas.0.dylib
LAPACK:
/Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.2.1


------- snip -------

I discovered this issue when a user (cc'd above) wrote to me about
having to install the macOS developer tools in order to use the Rcmdr
package. I didn't encounter the problem myself because (of course) I
have the developer tools installed. I was able to reproduce the problem
by dusting off an old Mac without R installed and starting from scratch.

I believe that this issue has arisen before, e.g., on R 3.1.2; see
<https://stat.ethz.ch/pipermail/r-sig-mac/2014-December/011260.html>.

Can this be fixed again in R-patched?

Thank you,
John

--
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/

_______________________________________________
R-SIG-Mac mailing list
R-SI...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac

peter dalgaard

unread,
Sep 2, 2022, 1:38:39 PM9/2/22
to John Fox, r-si...@r-project.org, andreas....@lnu.se
Hmm, that would obviously be a condition that developers would overlook, but the direct cause seems to be the absence of libX11.6.dylib. On the face of things, the otool business is just a warning. Was XQuartz installed and working? (Not to say that your diagnosis is definitely wrong, I don't have a system without otool for testing...)

- Peter
--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd....@cbs.dk Priv: PDa...@gmail.com

Simon Urbanek

unread,
Sep 2, 2022, 3:25:42 PM9/2/22
to John Fox, r-si...@r-project.org, andreas....@lnu.se
John,

Please note that the error is missing X11: tcktk requires XQuartz.

Dev tools are optional and help giving a better error if installed, but they are not required.

Cheers,
Simon


> On 3/09/2022, at 05:00, John Fox <jf...@mcmaster.ca> wrote:
>
> Dear R-SIG-MAC list members,

John Fox

unread,
Sep 2, 2022, 5:04:20 PM9/2/22
to Simon Urbanek, r-si...@r-project.org, andreas....@lnu.se
Hi Simon,

My apologies for muddying the waters. Yes, it's been so long that I've
worked on a Mac without XQuartz that I forgot to install it -- even
though the most common problem with the Rcmdr on Macs is failure to
install XQuartz!

But there's still a problem: With XQuartz installed and without the
developer tools, loading the Rcmdr or just the tcltk package produces
the warning

Warning message:
In system2("/usr/bin/otool", c("-L", shQuote(DSO)), stdout = TRUE) :
running command ''/usr/bin/otool' -L
'/Library/Frameworks/R.framework/Resources/library/tcltk/libs//tcltk.so''
had status 1
xcode-select: note: no developer tools were found at
'/Applications/Xcode.app', requesting install. Choose an option in the
dialog to download the command line developer tools.

and, as this warning states, a dialog box pops up offering to install
the developer tools.

I suspect that most users will respond positively and have to wait
through a potentially long download, even though tcltk and the Rcmdr
load properly if the offer to install the development tools is declined.

Best,
John

John Fox

unread,
Sep 2, 2022, 5:09:55 PM9/2/22
to peter dalgaard, r-si...@r-project.org, andreas....@lnu.se
Hi Peter,

Thanks for noticing my failure to install XQuartz. Simon caught that too.

Even with XQuartz installed, however, the absence of the developer tools
triggers a warning on loading tcltk, and a dialog box pops up offering
to install the developer tools -- even though these aren't necessary for
the tcltk package (and hence the Rcmdr package) to work.

Best,
John

Simon Urbanek

unread,
Sep 3, 2022, 12:13:24 AM9/3/22
to John Fox, r-si...@r-project.org, andreas....@lnu.se
John,

please file an R bug report. The code guards against the absence of /usr/bin/otool, but it doesn't guard against it being a stub so I presume this is really macOS version specific so make sure you include the full details. Quick grep suggests that something similar is used for X11 as well, so it would make sense to clean it up - personally, I wouldn't use otool for this, but working around it is non-trivial, because any call to xcrun results in the dialog being popped up. (That said, this is very minor since user's response to that dialog is irrelevant, so I don't think this will be high on anyone's priority list).

Cheers,
Simon
Reply all
Reply to author
Forward
0 new messages