GNOME Bugzilla – Bug 617867
gtk+/gdk-pixbuf fails to build from git outside source tree
Last modified: 2011-03-02 01:24:30 UTC
By setting 'buildroot' in .jhbuildrc so that jhbuild builds stuffs from outside git source trees, GTK+ fails to build, with the following messages: ---8<--- libtool: link: gcc -DGDK_PIXBUF_DISABLE_DEPRECATED -g -O2 -I/home/gnome2/include -Wall -o .libs/test-gdk-pixbuf test-gdk-pixbuf.o -pthread -L/home/gnome2/lib64 ./.libs/libgdk_pixbuf-2.0.so /home/gnome2/lib64/libgio-2.0.so /home/gnome2/lib64/libgobject-2.0.so /home/gnome2/lib64/libgmodule-2.0.so /home/gnome2/lib64/libgthread-2.0.so -lrt /home/gnome2/lib64/libglib-2.0.so -lm -pthread -Wl,-rpath -Wl,/home/gnome2/lib64 make[4]: Leaving directory `/home/thep/build/gnome_git/gtk+/gdk-pixbuf' make[3]: Leaving directory `/home/thep/build/gnome_git/gtk+/gdk-pixbuf' make[2]: Leaving directory `/home/thep/build/gnome_git/gtk+/gdk-pixbuf' make[1]: Leaving directory `/home/thep/build/gnome_git/gtk+' make[4]: *** No rule to make target `/home/thep/vcs/gnome_git/gtk+/gdk-pixbuf/gdk-pixbuf-enum-types.h', needed by `GdkPixbuf-2.0.gir'. Stop. make[3]: *** [all-recursive] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 ---8<--- It's these lines that caused the problem: > GdkPixbuf_2_0_gir_FILES = \ > $(addprefix $(srcdir)/,$(libgdk_pixbufinclude_HEADERS)) \ > $(addprefix $(srcdir)/,$(libgdk_pixbuf_2_0_la_SOURCES)) Here, $(libgdk_pixbufinclude_HEADERS) and $(libgdk_pixbuf_2_0_la_SOURCES) include all headers and source files, including generated files in $(builddir). So, adding $(srcdir) prefix here is just wrong. Similar problems also occur in gdk/ and gtk/ subdirs. Note that this kind of problem may not be caught by 'make distcheck', as the generated files are included in the distributed tarball. But this is not the case for VCS builds, such as with jhbuild.
Created attachment 160410 [details] [review] Fixes for the 3 subdirs For gdk-pixbuf: - Split the generated sources from the list and treat them differently, just like how header files are done. - Note that gdk-pixdata.h seems to be manual source file. So, it's moved into $(gdk_pixbuf_headers). If this causes problem in some rules, let's try another way. For gdk: - Split $(introspection_files) into 2 categories: manual and built, and treat them differently. - $(srcdir) prefix is removed from "$(srcdir)/x11/*.c", as it's to be added later in Gdk_2_0_gir_FILES line. Adding it twice causes build failure when builddir != srcdir. (I later found similar report in Bug 613788.) For gtk: - Generated sources are split from $(gtk_base_c_sources) into $(gtk_base_c_built_sources), and the latter is added to all other irrelevant appearances of the former, to retain old behavior. - $(introspection_files) contents are replaced with fine-grained lists. Only manual files are included. And generated files are moved into $(introspection_built_sources), which are treated differently in Gtk_2_0_gir_FILES assignment.
Created attachment 160553 [details] [review] Updated patch with conflicts resolved Updates in this patch: - Format patch with git format-patch - Resolve conflict with recent changes in gtk/Makefile.am - Fix problem with gdk-pixbuf/gdk-pixdata.h introduced in previous patch, as $(gdk_pixbuf_headers) are also used in gdk-pixbuf-enum-types.h generation. Adding gdk-pixdata.h to it just caused excessive source injection to $(GLIB_MKENUMS), and thus compilation error after that.
Created attachment 160630 [details] [review] Yet another conflict resolution
Reassign the bug to gdk-pixbuf, which is now split out of GTK+, and is the only one left affected by this bug.
Created attachment 165207 [details] [review] Updated patch, only for gdk-pixbuf With this update: - I've rearranged GdkPixbuf_2_0_gir_FILES so that gdk-pixdata.h is also included, and the files are listed in the same order as defined in the previously used *_HEADERS and *_SOURCES variables. - gdk-pixbuf-alias.h is added to MAINTAINERCLEANFILES, as it's still left after 'make distclean'.
Created attachment 165215 [details] [review] Updated patch for GTK+ 2.21.x It appears GTK+ 2.21.x is still affected by this bug. And this patch is updated to catch up with recent git snapshot. Now gtk/gtkmarshal.h is another file that causes the problem.
Reassigned the bug back to general GTK+.
See also Bug 623520 for GTK+ 3.
The split into srcdir and builddir sources shouldn't be necessary anymore now that bug 616425 is fixed.
Created attachment 165223 [details] [review] Updated patch for gdk-pixbuf, remove srcdir prefix Updated patch for gdk-pixbuf, by removing $(addprefix ...) clause and let the files be resolved via VPATH, according to gobject-introspection >= 0.6.14. For GTK+ 2.21.x, it depends on gobject-introspection >= 0.6.7, which is too old for the change, and changing the dependency for a stable version is not a good idea, is it?
This was fixed for gdk-pixbuf in commit 866cb727612f8d9c0