Subject: bug#52564: Errors building pgtk in Fedora 34 & 35 using --with-xwidgets

From: Sebastián Monía <[email-masked]>
Date: Fri, 17 Dec 2021 04:45:46 +0000

Hello!

Building Emacs pgtk branch, I get compilation errors running make. Started using Fedora 34, but upgraded to Fedora 35 in case I had something outdated but still, same problem. A bunch of the compilation errors refer to the same structs/data types so I have a sample of one of each (but maybe I missed one "type"):

--------------------------------------------------------------------------------
In file included from /usr/include/X11/Xlib.h:44,
                 from xwidget.h:35,
                 from window.c:41:
/usr/include/X11/X.h:96:13: error: conflicting types for ‘Window’; have ‘XID’ {aka ‘long unsigned int’}
   96 | typedef XID Window;
      |             ^~~~~~
--------------------------------------------------------------------------------
In file included from xwidget.h:35,
                 from window.c:41:
/usr/include/X11/Xlib.h:433:3: error: conflicting types for ‘XRectangle’; have ‘struct <anonymous>’
  433 | } XRectangle;
|   ^~~~~~~~~~
--------------------------------------------------------------------------------
In file included from xwidget.h:35,
                 from window.c:41:
/usr/include/X11/Xlib.h:487:26: error: conflicting types for ‘Display’; have ‘struct _XDisplay’
  487 | typedef struct _XDisplay Display;
      |                          ^~~~~~~
--------------------------------------------------------------------------------
In file included from xwidget.h:35,
                 from dispnew.c:43:
/usr/include/X11/Xlib.h:1067:3: error: conflicting types for ‘XChar2b’; have ‘struct <anonymous>’
 1067 | } XChar2b;
      |   ^~~~~~~
--------------------------------------------------------------------------------
In file included from xwidget.h:36,
                 from emacsgtkfixed.c:30:
xterm.h:1174:1: error: conflicting types for ‘x_display_pixel_width’; have ‘int(struct x_display_info *)’
 1174 | x_display_pixel_width (struct x_display_info *dpyinfo)
      | ^~~~~~~~~~~~~~~~~~~~~
--------------------------------------------------------------------------------

Posted on Reddit about it, two people provided very useful insights:

1. Removing the --with-xwidgets flag allowed me to build.

2. Quote: "The file /usr/include/X11/Xlib.h in your message is from libx11-dev / libx11-devel. Looking at their GitLab CI file, they test against Debian 9 stretch which uses version 1.6.4 (according to https://packages.debian.org/stretch/libx11-dev) whereas Fedora 35 libx11-devel is using version 1.7.3 (according to https://packages.fedoraproject.org/pkgs/libX11/libX11-devel/)"

(link to reddit post: https://www.reddit.com/r/emacs/comments/rht9yw/cant_compile_pgtk_in_fedora_35/)

Being that this is a build of master, I would assume it is low priority :)

Thank you!
Sebastián