Just as a follow up to this for the archives, since it has been fixed in Evince[0]:
- the issue is caused by a double declaration of `GType ev_document_model_get_type (void)`—one by the G_DECLARE_FINAL_TYPE at line 33, and one explicit at line 57. This confuses the g-ir-scanner parser, and would be nice to track it down a bit further - next time, you probably want to use gir-devel-list for this kind of issues, not gtk-app-devel-list Ciao, Emmanuele. [0]: https://gitlab.gnome.org/GNOME/evince/merge_requests/82 On Fri, 7 Sep 2018 at 07:35, Iñigo Martínez via gtk-app-devel-list < gtk-app-devel-list@gnome.org> wrote: > Hello, > > I have recently started porting evince to meson. The port is almost > complete but I have an issue with the generation of introspection data of > one of its libraries, `libevview3`, which I haven't been able to figure out > due to my limited introspection knowledge. > > The introspection build parameters are as follows in the autotools' > Makefile[0]: > > ``` > INTROSPECTION_COMPILER_ARGS = --includedir=$(top_builddir)/libdocument > > EvinceView-$(EV_API_VERSION).gir: libevview3.la > EvinceView_@EV_API_VERSION_U@_gir_FILES = \ > $(INST_H_SRC_FILES) \ > $(INST_H_BUILT_FILES) \ > $(filter %.c,$(libevview3_la_SOURCES)) > EvinceView_@EV_API_VERSION_U@_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0 > Gdk-3.0 GdkPixbuf-2.0 Gtk-3.0 > EvinceView_@EV_API_VERSION_U@_gir_LIBS = libevview3.la > $(top_builddir)/libdocument/libevdocument3.la > EvinceView_@EV_API_VERSION_U@_gir_CFLAGS = \ > -I$(top_srcdir) \ > -I$(top_builddir) \ > -I$(top_srcdir)/libdocument \ > -I$(top_builddir)/libdocument \ > -DEVINCE_COMPILATION > EvinceView_@EV_API_VERSION_U@_gir_EXPORT_PACKAGES = > evince-view-$(EV_API_VERSION) > EvinceView_@EV_API_VERSION_U@_gir_SCANNERFLAGS = \ > --add-include-path=$(top_builddir)/libdocument \ > > > --include-uninstalled=$(top_builddir)/libdocument/EvinceDocument-$(EV_API_VERSION).gir > \ > --identifier-prefix=Ev \ > --symbol-prefix=ev > INTROSPECTION_GIRS = EvinceView-$(EV_API_VERSION).gir > > girdir = $(datadir)/gir-1.0 > gir_DATA = EvinceView-$(EV_API_VERSION).gir > > typelibsdir = $(libdir)/girepository-1.0 > typelibs_DATA = EvinceView-$(EV_API_VERSION).typelib > ``` > > These produces the following command lines: > > ``` > CPPFLAGS="" CFLAGS="-g -O2" LDFLAGS="-L/home/imartinez/jhbuild/install/lib > " CC="gcc" PKG_CONFIG="/usr/bin/pkg-config" GI_HOST_OS="" DLLTOOL="false" > /usr/bin/g-ir-scanner --namespace=EvinceView --nsversion=3.0 > --libtool="/bin/bash ../libtool" --include=GLib-2.0 --include=GObject-2.0 > --include=Gio-2.0 --include=Gdk-3.0 --include=GdkPixbuf-2.0 > --include=Gtk-3.0 --pkg-export=evince-view-3.0 --library=libevview3.la > --library=../libdocument/libevdocument3.la > --add-include-path=../libdocument > --include-uninstalled=../libdocument/EvinceDocument-3.0.gir > --identifier-prefix=Ev --symbol-prefix=ev --cflags-begin -I.. -I.. > -I../libdocument -I../libdocument -DEVINCE_COMPILATION --cflags-end > ev-document-model.h ev-jobs.h ev-job-scheduler.h ev-print-operation.h > ev-stock-icons.h ev-view.h ev-view-presentation.h ev-view-type-builtins.h > ev-annotation-window.c ev-document-model.c ev-form-field-accessible.c > ev-image-accessible.c ev-jobs.c ev-job-scheduler.c ev-link-accessible.c > ev-page-accessible.c ev-page-cache.c ev-pixbuf-cache.c ev-print-operation.c > ev-stock-icons.c ev-timeline.c ev-transition-animation.c ev-view.c > ev-view-accessible.c ev-view-cursor.c ev-view-presentation.c > ev-media-player.c libevview3.la --output EvinceView-3.0.gir > g-ir-scanner: link: /bin/bash ../libtool --mode=link --tag=CC gcc -o > > /home/imartinez/Development/gnome/evince-at/libview/tmp-introspectfyj_c9fn/EvinceView-3.0 > -export-dynamic -g -O2 > > /home/imartinez/Development/gnome/evince-at/libview/tmp-introspectfyj_c9fn/EvinceView-3.0.o > -L. libevview3.la ../libdocument/libevdocument3.la > -L/home/imartinez/jhbuild/install/lib -lgio-2.0 -lgobject-2.0 > -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 > -L/home/imartinez/jhbuild/install/lib > libtool: link: gcc -o > > /home/imartinez/Development/gnome/evince-at/libview/tmp-introspectfyj_c9fn/.libs/EvinceView-3.0 > -g -O2 > > /home/imartinez/Development/gnome/evince-at/libview/tmp-introspectfyj_c9fn/EvinceView-3.0.o > -Wl,--export-dynamic -pthread -Wl,--export-dynamic -L. > ./.libs/libevview3.so ../libdocument/.libs/libevdocument3.so > -L/home/imartinez/jhbuild/install/lib -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 > -lglib-2.0 -pthread -Wl,-rpath -Wl,/tmp/evince/lib > g-ir-scanner: EvinceView: warning: 2 warnings suppressed (use --warn-all to > see them) > ``` > > This command creates the `EvinceView-3.0.gir` file properly. I tried to > replicate this on meson by using the same parameters[1]: > > ``` > incs = [ > 'Gdk-3.0', > 'GdkPixbuf-2.0', > 'Gio-2.0', > 'GLib-2.0', > 'GObject-2.0', > 'Gtk-3.0', > libevdocument_gir[0], > ] > > gnome.generate_gir( > [libevview, libevdocument], > sources: sources + headers + [enum_sources[1]], > includes: incs, > nsversion: ev_api_version, > namespace: 'EvinceView', > identifier_prefix: ev_code_prefix, > symbol_prefix: ev_code_prefix.to_lower(), > export_packages: 'evince-view-' + ev_api_version, > extra_args: '-DEVINCE_COMPILATION', > install: true, > ) > ``` > > These produces the following command line: > > ``` > /usr/bin/g-ir-scanner -pthread > -I/home/imartinez/jhbuild/install/include/glib-2.0 > -I/home/imartinez/jhbuild/install/lib/glib-2.0/include > -I/usr/include/gobject-introspection-1.0 --no-libtool > --namespace=EvinceView --nsversion=3.0 --warn-all --output > libview/EvinceView-3.0.gir -DEVINCE_COMPILATION > -I/home/imartinez/Development/gnome/evince/libview > -I/home/imartinez/Development/gnome/evince/_build/libview -I./. -I../. > -I./libdocument/. -I../libdocument/. -I./. -I../. > --filelist=/home/imartinez/Development/gnome/evince/_build/libview/libview@ > @evview3@sha/EvinceView_3.0_gir_filelist --include=Gdk-3.0 > --include=GdkPixbuf-2.0 --include=Gio-2.0 --include=GLib-2.0 > --include=GObject-2.0 --include=Gtk-3.0 > --include-uninstalled=libdocument/EvinceDocument-3.0.gir --symbol-prefix=ev > --identifier-prefix=Ev --pkg-export=evince-view-3.0 --cflags-begin > -DHAVE_CONFIG_H -DHAVE_CONFIG_H -I./. -I../. -I./libdocument/. > -I../libdocument/. -I/home/imartinez/jhbuild/install/include/gio-unix-2.0 > -I/home/imartinez/jhbuild/install/include/glib-2.0 > -I/home/imartinez/jhbuild/install/lib/glib-2.0/include > -I/usr/include/gspell-1 -I/usr/include/gtk-3.0 > -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 > -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include > -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz > -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/pixman-1 > -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 > -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/enchant > -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 > -I/usr/include/gtk-3.0/unix-print -I/usr/include/synctex --cflags-end -I./. > -I../. -I./libdocument/. -I../libdocument/. > --add-include-path=/usr/share/gir-1.0 > > --add-include-path=/home/imartinez/Development/gnome/evince/_build/libdocument > --add-include-path=./. --add-include-path=../. > --add-include-path=./libdocument/. --add-include-path=../libdocument/. > -L/home/imartinez/Development/gnome/evince/_build/libdocument > -L/home/imartinez/jhbuild/install/lib --extra-library=evdocument3 > -L/home/imartinez/Development/gnome/evince/_build/libdocument > -L/home/imartinez/jhbuild/install/lib --library evview3 > -L/home/imartinez/Development/gnome/evince/_build/libview > -L/home/imartinez/jhbuild/install/lib --library evdocument3 > -L/home/imartinez/Development/gnome/evince/_build/libview > -L/home/imartinez/jhbuild/install/lib -L/home/imartinez/jhbuild/install/lib > -L/home/imartinez/jhbuild/install/lib --extra-library=gspell-1 > --extra-library=gtk-3 --extra-library=gdk-3 --extra-library=pangocairo-1.0 > --extra-library=pango-1.0 --extra-library=atk-1.0 > --extra-library=cairo-gobject --extra-library=cairo > --extra-library=gdk_pixbuf-2.0 --extra-library=gio-2.0 > --extra-library=gobject-2.0 --extra-library=glib-2.0 > --extra-library=enchant --extra-library=gstbase-1.0 > --extra-library=gstreamer-1.0 --extra-library=gstvideo-1.0 > --extra-library=gthread-2.0 --extra-library=m --extra-library=gmodule-2.0 > --extra-library=synctex --extra-library=z > ``` > > However, it seems that the important parameters are in place, in the same > way as autotools does. > > libs: `--library evview3 --library evdocument3` > namespace: `--namespace=EvinceView` > namespace version: `--nsversion=3.0` > girs: `--output EvinceView-3.0.gir` > includes: `--include=Gdk-3.0 --include=GdkPixbuf-2.0 --include=Gio-2.0 > --include=GLib-2.0 --include=GObject-2.0 --include=Gtk-3.0` > scanner flags: `--add-include-path=./libdocument/ > --include-uninstalled=libdocument/EvinceDocument-3.0.gir > --identifier-prefix=Ev --symbol-prefix=ev` > export packages: `--pkg-export=evince-view-3.0` > cflags: `-DEVINCE_COMPILATION` > > The contents of the 'filelist' file 'EvinceView_3.0_gir_filelist', contains > the same list of files as those used by autotools: > > ``` > ../libview/ev-annotation-window.c > ../libview/ev-document-model.c > ../libview/ev-form-field-accessible.c > ../libview/ev-image-accessible.c > ../libview/ev-jobs.c > ../libview/ev-job-scheduler.c > ../libview/ev-link-accessible.c > ../libview/ev-page-accessible.c > ../libview/ev-page-cache.c > ../libview/ev-pixbuf-cache.c > ../libview/ev-print-operation.c > ../libview/ev-stock-icons.c > ../libview/ev-timeline.c > ../libview/ev-transition-animation.c > ../libview/ev-view.c > ../libview/ev-view-accessible.c > ../libview/ev-view-cursor.c > ../libview/ev-view-presentation.c > ../libview/ev-media-player.c > ../libview/ev-document-model.h > ../libview/ev-jobs.h > ../libview/ev-job-scheduler.h > ../libview/ev-print-operation.h > ../libview/ev-stock-icons.h > ../libview/ev-view.h > ../libview/ev-view-presentation.h > > /home/imartinez/Development/gnome/evince/_build/libview/ev-view-type-builtins.h > ``` > > As you can also see, meson doesn't use libtool to assist in the creation of > the introspection data. It also appends some libraries/dependencies used in > the generation of the `libevview3` by using the `--extra-libraries` option. > > However, meson is not able to generate the introspection data due to the > following error: > > ``` > libview/ev-document-model.h:33: > libview/ev-document-model.h:57: Fatal: EvinceView: Namespace conflict for > 'document_model_get_type' > libview/ev-document-model.h:57: Fatal: EvinceView: Namespace conflict for > 'document_model_get_type' > ``` > > I'm not able to figure out what is the reason behind the `Namespace > conflict`. When using autotools, the information from `DocumentModel` is > properly included in the introspection data in the following way: > > ``` > <namespace name="EvinceView" > version="3.0" > shared-library="libevview3.so.3,libevdocument3.so.4" > c:identifier-prefixes="Ev" > c:symbol-prefixes="ev"> > <class name="DocumentModel" > c:symbol-prefix="document_model" > c:type="EvDocumentModel" > parent="GObject.Object" > glib:type-name="EvDocumentModel" > glib:get-type="ev_document_model_get_type" > glib:type-struct="DocumentModelClass"> > ``` > > Does anyone have any idea about what might be happening? > > Thanks, > > Best regards, > > [0] > https://gitlab.gnome.org/GNOME/evince/blob/master/libview/Makefile.am#L137 > [1] > > https://gitlab.gnome.org/inigomartinez/evince/blob/meson/libview/meson.build#L124 > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list > -- https://www.bassi.io [@] ebassi [@gmail.com] _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list