Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11 back-end breaks without libXt #39

Closed
glin opened this issue Sep 20, 2022 · 3 comments
Closed

X11 back-end breaks without libXt #39

glin opened this issue Sep 20, 2022 · 3 comments

Comments

@glin
Copy link

glin commented Sep 20, 2022

Hi, when installing Cairo from source on Linux, libXt seems to be required in addition to Cairo, but libXt isn't mentioned in the SystemRequirements field or package README.

Without the development files for libXt installed, Linux users run into compilation errors without an obvious resolution like this:

> install.packages("Cairo")
...
gcc -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16   -I. -Iinclude  -I/usr/local/include  -g -O2 -fpic  -g -O2  -c xlib-backend.c -o xlib-backend.o
xlib-backend.c:34:10: fatal error: X11/Intrinsic.h: No such file or directory
   34 | #include <X11/Intrinsic.h>      /*->    Xlib.h  Xutil.h Xresource.h .. */
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [/opt/R/4.2.1/lib/R/etc/Makeconf:168: xlib-backend.o] Error 1
ERROR: compilation failed for packageCairo* removing/opt/R/4.2.1/lib/R/library/Cairo

Searching for the error message turns up many questions over the years about Cairo also requiring libXt development files (e.g. libxt-dev on Ubuntu/Debian or libXt-devel on CentOS/RHEL/Fedora):

To help users install Cairo on Linux, would you be open to adding libXt to SystemRequirements or the package README?

This would also help out tools that use SystemRequirements, like the automatic system dependency installation used by the GitHub Actions for R, R-hub, and the Linux binary packages from RStudio Package Manager (https://packagemanager.rstudio.com/). This was the original motivation for opening this, via rstudio/r-system-requirements#31.

@s-u
Copy link
Owner

s-u commented Sep 20, 2022

Interesting, sounds reasonable - I would expect that libcairo would already cover it, but it's quite possible that we use additional X11 handling for things like the locator, so that has added the Xt dependency.

Technically, it is not required, it just won't build the X11 back-end which is optional. I wonder what is the best way forward. The most logical way to address this would be to check for libXt in configure and disable X11 support if it is not present. That would fix the reported bug. However, it would mean that users that don't install libXt won't have X11 support - which is fine, but perhaps they wanted X11 support - it's not clear to me.

So in short, IibXt is not a requirement, so modifying SystemRequirements: doesn't seem right like the right way - cairo is the only actual requirement. However, I'm not sure how automatic systems that you list are dealing with optional dependencies. There is no offical SystemSuggests: entry or some such.

@s-u s-u changed the title Add libXt requirement to SystemRequirements? X11 back-end breaks without libXt Sep 20, 2022
@s-u s-u closed this as completed in f779058 Sep 20, 2022
@s-u
Copy link
Owner

s-u commented Sep 20, 2022

It turns out it's much easier than that - we don't need Xt =)

@glin
Copy link
Author

glin commented Sep 21, 2022

That's fantastic, and I can confirm that the latest development version no longer requires libXt. Thanks!

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

No branches or pull requests

2 participants