Skip to content
This repository was archived by the owner on Feb 14, 2023. It is now read-only.

R believes that X11 isn't install, even when it is? #149

Open
ctross opened this issue Apr 23, 2021 · 8 comments
Open

R believes that X11 isn't install, even when it is? #149

ctross opened this issue Apr 23, 2021 · 8 comments

Comments

@ctross
Copy link

ctross commented Apr 23, 2021

Thanks for making your code for imager free for us all to use.

I am using the imager package specifically for the grabPoint() function in my own package.

Everything works fine when I run the package on a windows machine. But, on Mac, the function fails, with a message that X11 needs to be installed: "Error in select(im) : Please install X11 library to use this function."

This is where it gets weird. If we run, capabilities(), X11=TRUE. Similarly, we can run data.entry() which pulls up a working GUI in R. So, X11 is working fine, but imager, or really, just select() from cimg, doesn't believe X11 is there.

I was able to try on a second Mac, with an older imager version, and it worked.

This lead me to think that maybe, in your last commit, some code was introduced that makes R believe that X11 isn't install, even when it is?

Any idea if this is right? Or how to figure out where?

@ShotaOchi
Copy link
Contributor

CRAN required me to disable functions that use X11 library to retain imager on CRAN when autotools can't find X11 library.
That's why I modified imager.
I don't know why autotools can't find X11 library on your Mac machine if XQuartz is installed on your Mac machine.

An idea to avoid the disablement is to modify the following line of configure.ac file

DONT_HAVE_X11='-Dcimg_display=0'

like this
DONT_HAVE_X11=''

The idea is a temporary measure.
It's better to find out the reason for the disablement but I don't have a Mac machine.

@ctross
Copy link
Author

ctross commented Apr 24, 2021

I have now tested on several Mac machines, and they all have this error.

Autotools does find X11, but Imager does not detect X11. This causes Imager to disable some functions even when it shouldn't.

How does Imager detect when the X11 library isn't installed? Could there be a bug there?

@ctross
Copy link
Author

ctross commented Apr 24, 2021

PS. Thanks for the quick and help replies!

@ShotaOchi
Copy link
Contributor

imager uses AC_PATH_X to locate the X11 and test whether the X11 is available or not with AC_CHECK_LIB.

imager/configure.ac

Lines 51 to 52 in 9173851

AC_PATH_X
AC_CHECK_LIB(X11, XOpenDisplay, [HAVE_LIBX11=TRUE], [HAVE_LIBX11=FALSE])

The disablement means R failed to call XOpenDisplay function of X11.
I guess AC_CHECK_LIB needs some extra library to call the function.
We may find the extra library if AC_PATH_XTRA is used instead of AC_PATH_X.

@ajfedorec
Copy link

ajfedorec commented May 12, 2021

I have also just seen this error on my colleagues Mac after they upgraded their R version to 4.0.5. It had been working previously with R version 3.6

edit: and it appears that downgrading back to R 3.6 does not fix the issue.

@NKleinenkuhnen
Copy link

Same for me as for @ajfedorec haven't been able to use the library ever since upgrading to R 4.0.0 or R 4.0.5. Downgrading to 3.6.1 didn't help either.

@ShotaOchi
Copy link
Contributor

The problem is AC_CHECK_LIB(X11, XOpenDisplay, [HAVE_LIBX11=TRUE], [HAVE_LIBX11=FALSE]) fails on MacOS.
I'm not sure why it fails on macOS but the version of R is not a problem.
Is your macOS latest?
Does AC_CHECK_LIB work if you downgrade the version of macOS?
I don't know if autotools are maintained well for the latest version of macOS because macOS is unstable and requires high cost of software developers.

@ShotaOchi
Copy link
Contributor

ShotaOchi commented Jun 8, 2021

We don't have a solution to the problem at the moment.
I made a branch for Mac users.
https://github.com/ShotaOchi/imager/tree/imager_0_42_10_mac
R doesn't disable the functions that use X11 library when AC_CHECK_LIB(X11, XOpenDisplay, [HAVE_LIBX11=TRUE], [HAVE_LIBX11=FALSE]) fails.
Thus you should be able to use the functions that use X11 library on Mac OS.
Can you guys confirm it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants