mate-desktop / atril

A document viewer for MATE
http://www.mate-desktop.org
GNU General Public License v2.0
205 stars 62 forks source link

Undeclared dependency on gio-unix-2.0 #351

Open worldofpeace opened 5 years ago

worldofpeace commented 5 years ago

I am building atril 1.20.3 on NixOS and getting the following error:

ev-sidebar-thumbnails.c:337:2: warning: 'g_type_class_add_private' is deprecated [-Wdeprecated-declarations]
  g_type_class_add_private (g_object_class, sizeof (EvSidebarThumbnailsPrivate));
  ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/gobject/gobject.h:24:0,
                 from /nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/gobject/gbinding.h:29,
                 from /nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/glib-object.h:23,
                 from /nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/gio/gioenums.h:28,
                 from /nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/gio/giotypes.h:28,
                 from /nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/gio/gio.h:26,
                 from /nix/store/gs5zdwrvvfk6gzl5bmdanaf27pl37zhd-gtk+3-3.24.2-dev/include/gtk-3.0/gdk/gdkapplaunchcontext.h:28,
                 from /nix/store/gs5zdwrvvfk6gzl5bmdanaf27pl37zhd-gtk+3-3.24.2-dev/include/gtk-3.0/gdk/gdk.h:32,
                 from /nix/store/gs5zdwrvvfk6gzl5bmdanaf27pl37zhd-gtk+3-3.24.2-dev/include/gtk-3.0/gtk/gtk.h:30,
                 from ev-sidebar-thumbnails.c:32:
/nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0/gobject/gtype.h:1303:10: note: declared here
 void     g_type_class_add_private       (gpointer                    g_class,
          ^~~~~~~~~~~~~~~~~~~~~~~~
  CC       main.o
  CC       ev-media-player-keys.o
  CC       ev-resources.o
  CC       ev-gdbus-generated.o
ev-gdbus-generated.c:16:12: fatal error: gio/gunixfdlist.h: No such file or directory
 #  include <gio/gunixfdlist.h>
            ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:788: ev-gdbus-generated.o] Error 1
make[3]: Leaving directory '/build/atril-1.20.3/shell'
make[2]: *** [Makefile:600: all] Error 2
make[2]: Leaving directory '/build/atril-1.20.3/shell'
make[1]: *** [Makefile:669: all-recursive] Error 1
make[1]: Leaving directory '/build/atril-1.20.3'
make: *** [Makefile:555: all] Error 2

Downstream issue: NixOS/nixpkgs#36468

raveit65 commented 5 years ago
[root@mother rave]# dnf provides */gio/gunixfdlist.h
Letzte Prüfung auf abgelaufene Metadaten: vor 14:42:56 am Di 15 Jan 2019 19:39:10 CET.
glib2-devel-2.56.4-1.fc28.x86_64 : A library of handy utility functions
Quelle      : @System
Übereinstimmung von:
Dateiname     : /usr/include/gio-unix-2.0/gio/gunixfdlist.h

You need to set/install glib2-devel as build requires/dependency.

worldofpeace commented 5 years ago

This is something that shouldn't be left up to the package manager to ensure.

Certain software require gio/gdesktopappinfo.h header, which is provided by gio-unix-2.0 and shouldn't be satisfied transitively.

If you read our downstream issue we've been pretty successful in fixing this in upstream gnome.

jtojnar commented 5 years ago

We actually do have glib.dev in build dependencies, it is just that the compiler is not passed -I/usr/include/gio-unix-2.0/. pkg-config --cflags gio-unix-2.0 needs to be explicitly added to CFLAGS in order for headers to be found.

yetist commented 5 years ago

Yes, we should add gio-unix-2.0 check in configure.ac.

raveit65 commented 5 years ago

We actually do have glib.dev in build dependencies, it is just that the compiler is not passed -I/usr/include/gio-unix-2.0/. pkg-config --cflags gio-unix-2.0 needs to be explicitly added to CFLAGS in order for headers to be found.

Weird, i never had such a problem if i build atril on fedora koji build-server. https://src.fedoraproject.org/cgit/rpms/atril.git/tree/atril.spec#n32 glib2-devel is one the packages which will be include by fedora for every rpm. But Ok, if it is needed for your distro......

jtojnar commented 5 years ago

IIRC fedora gets pkg-config --cflags gio-unix-2.0 from some other package (maybe pkg-config --cflags gtk-3.0).

yetist commented 5 years ago

After checking it again, I think it's a distribution issue. It seems that the gtk3 packaged by nixos is incorrect. Normally packaged gtk3 adds a dependency on gio-unix-2.0, unless the environment for compiling gtk3 is incomplete.

The gtk-3.24.2 used by nixos is also depends on gio-unix-2.0: https://gitlab.gnome.org/GNOME/gtk/blob/3.24.2/configure.ac#L1417

Please confirm whether -I/usr/include/gio-unix-2.0 is included in the output of the following commands on nixos? If not, please report bugs to nixos.

pkg-config --cflags gtk+-3.0
jtojnar commented 5 years ago

I guess the main problem stems from pkgconfig#7. We have decided to interpret the pkg-config specification to not include Requires.private in --cflags to avoid the pkgconfig#7 and also pkgconfig#28.

$ nix-shell --pure -p gtk3 pkgconfig --run "pkg-config --cflags gtk+-3.0"
-I/nix/store/gs5zdwrvvfk6gzl5bmdanaf27pl37zhd-gtk+3-3.24.2-dev/include/gtk-3.0 -I/nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include -I/nix/store/1hy3jy3bkz84yjg1vvdw1jyl6bpjm9bg-glib-2.58.2-dev/include/glib-2.0 -I/nix/store/8q73aw4x32izb0gvzadjvj3a298bbwyy-glib-2.58.2/lib/glib-2.0/include -I/nix/store/yz1m10kz4v4k44q1l691s9lj7xcd29dq-cairo-1.16.0-dev/include/cairo -I/nix/store/67zcs5qzkc6i2mkj2pchma40754y0k5k-freetype-2.9-dev/include/freetype2 -I/nix/store/67zcs5qzkc6i2mkj2pchma40754y0k5k-freetype-2.9-dev/include -I/nix/store/v53bn3zha26plk7wmzsqxzv5ziwbwbkv-pango-1.42.4-dev/include/pango-1.0 -I/nix/store/42w7jqb64mvyz9l1m36577bdibxaqah6-gdk-pixbuf-2.38.0-dev/include/gdk-pixbuf-2.0 -I/nix/store/scklfi0dyfyg5kpirj81jz6jdpw3q2b1-atk-2.30.0-dev/include/atk-1.0

Nevertheless, I would expect us to directly depend on all libraries whose headers we include. See, for example, that we depend on gio-2.0, even though it is already in Requires of gtk3. Transitive dependencies may be in theory removed any time so relying on them might be unsafe.