Cannot compile programs that use gtk.h and -Werror

Bug #1849873 reported by Dan Kegel
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gtk+2.0 (Ubuntu)
Triaged
Low
Unassigned

Bug Description

To reproduce:

sudo apt install libgtk2.0-dev && echo "#include <gtk/gtk.h>" > foo.c && gcc -Werror -c foo.c $(pkg-config --cflags gtk+-2.0) || echo FAIL

Should complete silently and produce foo.o, but instead, fails as follows:

Reading package lists... Done
Building dependency tree
Reading state information... Done
libgtk2.0-dev is already the newest version (2.24.32-4ubuntu1).
libgtk2.0-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
In file included from /usr/include/gtk-2.0/gtk/gtkobject.h:37,
                 from /usr/include/gtk-2.0/gtk/gtkwidget.h:36,
                 from /usr/include/gtk-2.0/gtk/gtkcontainer.h:35,
                 from /usr/include/gtk-2.0/gtk/gtkbin.h:35,
                 from /usr/include/gtk-2.0/gtk/gtkwindow.h:36,
                 from /usr/include/gtk-2.0/gtk/gtkdialog.h:35,
                 from /usr/include/gtk-2.0/gtk/gtkaboutdialog.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:33,
                 from foo.c:1:
/usr/include/gtk-2.0/gtk/gtktypeutils.h:236:1: error: ‘GTypeDebugFlags’ is deprecated [-Werror=deprecated-declarations]
  236 | void gtk_type_init (GTypeDebugFlags debug_flags);
      | ^~~~
In file included from /usr/include/glib-2.0/gobject/gobject.h:24,
                 from /usr/include/glib-2.0/gobject/gbinding.h:29,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from /usr/include/glib-2.0/gio/gioenums.h:28,
                 from /usr/include/glib-2.0/gio/giotypes.h:28,
                 from /usr/include/glib-2.0/gio/gio.h:26,
                 from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
                 from /usr/include/gtk-2.0/gdk/gdk.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32,
                 from foo.c:1:
/usr/include/glib-2.0/gobject/gtype.h:679:1: note: declared here
  679 | {
      | ^
In file included from /usr/include/gtk-2.0/gtk/gtktoolitem.h:31,
                 from /usr/include/gtk-2.0/gtk/gtktoolbutton.h:30,
                 from /usr/include/gtk-2.0/gtk/gtkmenutoolbutton.h:30,
                 from /usr/include/gtk-2.0/gtk/gtk.h:126,
                 from foo.c:1:
/usr/include/gtk-2.0/gtk/gtktooltips.h:73:3: error: ‘GTimeVal’ is deprecated: Use 'GDateTime' instead [-Werror=deprecated-declarations]
   73 | GTimeVal last_popdown;
      | ^~~~~~~~
In file included from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /usr/include/glib-2.0/gobject/gbinding.h:28,
                 from /usr/include/glib-2.0/glib-object.h:23,
                 from /usr/include/glib-2.0/gio/gioenums.h:28,
                 from /usr/include/glib-2.0/gio/giotypes.h:28,
                 from /usr/include/glib-2.0/gio/gio.h:26,
                 from /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h:30,
                 from /usr/include/gtk-2.0/gdk/gdk.h:32,
                 from /usr/include/gtk-2.0/gtk/gtk.h:32,
                 from foo.c:1:
/usr/include/glib-2.0/glib/gtypes.h:551:8: note: declared here
  551 | struct _GTimeVal
      | ^~~~~~~~~
cc1: all warnings being treated as errors
FAIL

This is a regression since ubuntu 19.04.

Noticed while building cef.

Workaround: -DGTK_DISABLE_DEPRECATED

ProblemType: Bug
DistroRelease: Ubuntu 19.10
Package: libgtk2.0-dev 2.24.32-4ubuntu1
ProcVersionSignature: Ubuntu 5.3.0-18.19-generic 5.3.1
Uname: Linux 5.3.0-18-generic x86_64
ApportVersion: 2.20.11-0ubuntu8
Architecture: amd64
Date: Fri Oct 25 09:48:14 2019
InstallationDate: Installed on 2019-10-18 (7 days ago)
InstallationMedia: Ubuntu 19.10 "Eoan Ermine" - Release amd64 (20191017)
SourcePackage: gtk+2.0
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dan Kegel (dank) wrote :
Revision history for this message
Dan Kegel (dank) wrote :

Filed https://gitlab.gnome.org/GNOME/gtk/issues/2221 in case it's an upstream bug.
I'll probably regret that.

Changed in gtk+2.0 (Ubuntu):
importance: Undecided → Low
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.