Opened 8 years ago

Closed 3 years ago

#52248 closed defect (fixed)

inkscape, inkscape-devel +strict fails to build due to glibmm / glib2 deprecation misconfiguration

Reported by: jeremyhu (Jeremy Huddleston Sequoia) Owned by: mascguy (Christopher Nielsen)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: Cc: ryandesign (Ryan Carsten Schmidt), ob+macport@…, stott@…, fleason (Fred Leason), Schamschula (Marius Schamschula), astrofitz (Michael Fitzgerald), cooljeanius (Eric Gallager)
Port: glib2 glibmm inkscape inkscape-devel

Description (last modified by jeremyhu (Jeremy Huddleston Sequoia))

Updating to glib2-2.48.2 caused inkscape (or any project that uses parts of glibmm) to fail to build because gthread.h now obfuscates struct _GThread.

	/usr/bin/clang++ -DHAVE_CONFIG_H -I. -I..  -I../cxxtest -I./extension/dbus -I/opt/local/include -I/opt/local/include/freetype2   -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/local/include/ImageMagick-6 -I/opt/local/include/libwpg-0.3 -I/opt/local/include/libwpd-0.10 -I/opt/local/include/librevenge-0.0 -I/opt/local/include/libvisio-0.1 -I/opt/local/include -I/opt/local/include/libxml2 -I/opt/local/include -I/opt/local/include/librevenge-0.0 -I/opt/local/include/libcdr-0.1 -I/opt/local/include -I/opt/local/include/librevenge-0.0 -I/opt/local/include/dbus-1.0 -I/opt/local/lib/dbus-1.0/include -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include    -I/opt/local/include/poppler -D_REENTRANT -I/opt/local/include/poppler/glib -I/opt/local/include/poppler -I/opt/local/include/cairo -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -DPOTRACE=\"potrace\" -D_REENTRANT -I/opt/local/include/gtkspell-2.0 -I/opt/local/include/gtkmm-2.4 -I/opt/local/lib/gtkmm-2.4/include -I/opt/local/include/atkmm-1.6 -I/opt/local/include/gtk-unix-print-2.0 -I/opt/local/include/gtk-2.0 -I/opt/local/include/gdkmm-2.4 -I/opt/local/lib/gdkmm-2.4/include -I/opt/local/include/giomm-2.4 -I/opt/local/lib/giomm-2.4/include -I/opt/local/include/pangomm-1.4 -I/opt/local/lib/pangomm-1.4/include -I/opt/local/include/glibmm-2.4 -I/opt/local/lib/glibmm-2.4/include -I/opt/local/include/cairomm-1.0 -I/opt/local/lib/cairomm-1.0/include -I/opt/local/include/sigc++-2.0 -I/opt/local/lib/sigc++-2.0/include -I/opt/local/include/gtk-2.0 -I/opt/local/lib/gtk-2.0/include -I/opt/local/include/pango-1.0 -I/opt/local/include/gio-unix-2.0/ -I/opt/local/include -I/opt/local/include/cairo -I/opt/local/include/atk-1.0 -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -D_REENTRANT -I/opt/local/include -I/opt/local/include/cairomm-1.0 -I/opt/local/lib/cairomm-1.0/include -I/opt/local/include/cairo -I/opt/local/include/pixman-1 -I/opt/local/include -I/opt/local/include/giomm-2.4 -I/opt/local/lib/giomm-2.4/include -I/opt/local/include/glibmm-2.4 -I/opt/local/lib/glibmm-2.4/include -I/opt/local/include -I/opt/local/include/libxml2 -I/opt/local/include/pango-1.0 -I/opt/local/include/harfbuzz -I/opt/local/include -I/opt/local/include/pango-1.0 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include -I/opt/local/include/freetype2 -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include/sigc++-2.0 -I/opt/local/lib/sigc++-2.0/include  -I/opt/local/include -DG_DISABLE_DEPRECATED -DGLIBMM_DISABLE_DEPRECATED -DGDKMM_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED -DGTKMM_DISABLE_DEPRECATED -Werror=format-security -Wswitch -Werror=return-type -DGSEAL_ENABLE -DG_DISABLE_SINGLE_INCLUDES -Wall -Wformat -Wformat-security -W -D_FORTIFY_SOURCE=2 -I/opt/local/include -I/opt/local/var/macports/build/_Users_jeremy_src_macports_trunk_dports_graphics_inkscape/inkscape/work/inkscape-0.91/src/extension/script  -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Wswitch -Wno-unused-parameter -pipe -Os -std=c++11 -stdlib=libc++ -arch x86_64 -MT ui/dialog/spellcheck.o -MD -MP -MF $depbase.Tpo -c -o ui/dialog/spellcheck.o ui/dialog/spellcheck.cpp &&\
	mv -f $depbase.Tpo $depbase.Po
In file included from ui/dialog/new-from-template.cpp:12:
In file included from ui/dialog/new-from-template.h:14:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/dialog.h:31:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/box.h:59:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/container.h:30:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/widget.h:48:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/rc.h:31:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/style.h:46:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/iconset.h:35:
In file included from /opt/local/include/gtkmm-2.4/gtkmm/stockid.h:26:
In file included from /opt/local/include/glibmm-2.4/glibmm.h:89:
/opt/local/include/glibmm-2.4/glibmm/threads.h:209:11: error: field has incomplete type 'GThread' (aka '_GThread')
  GThread gobject_;
          ^
/opt/local/include/glib-2.0/glib/gthread.h:49:16: note: forward declaration of '_GThread'
typedef struct _GThread         GThread;
               ^
1 error generated.

Change History (23)

comment:1 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Cc: ryandesign@… added
Owner: changed from macports-tickets@… to devans@…

comment:2 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

It looks like gthread.h is getting included with G_DISABLE_DEPRECATED defined for some reason.

comment:3 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

I suspect that is happening is boiling down to:

#define G_DISABLE_DEPRECATED
#include <glib.h>

#undef G_DISABLE_DEPRECATED
#include <glib.h>

glibmm's thread.h unsets G_DISABLE_DEPRECATED if it is set and then includes <glib.h>, but the __G_LIB_H__ header guard prevents that from working if something before thread.h included it.

comment:4 Changed 8 years ago by dbevans (David B. Evans)

Status: newassigned

I believe inkscape sets G_DISABLE_DEPRECATED when the default +strict variant is set. Have you tried building with that disabled?

comment:5 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Description: modified (diff)

Yes, I see G_DISABLE_DEPRECATED is set, but so is GLIBMM_DISABLE_DEPRECATED, so we shouldn't even be in glibmm/thread.h. It looks like something is undefining GLIBMM_DISABLE_DEPRECATED.

Last edited 8 years ago by jeremyhu (Jeremy Huddleston Sequoia) (previous) (diff)

comment:6 Changed 8 years ago by dbevans (David B. Evans)

This code in glibmm/threads.h (also glibmm/thread.h) looks like a possible culprint:

// We use the (now deprecated) GThread definition in the API,
// and we cannot stop that without breaking ABI.
// (see the comment below),
// so we must temporarily undef G_DISABLE_DEPRECATED when
// including glib.h.

// Temporarily undef G_DISABLE_DEPRECATED, redefining it later if appropriate.
#if defined(G_DISABLE_DEPRECATED) && !defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED)

//Stop the deprecation ifdef guards around the API declarations:
#undef G_DISABLE_DEPRECATED

//Stop the compiler warnings about using the deprecated API;
#define GLIB_DISABLE_DEPRECATION_WARNINGS 1

#define GLIBMM_G_DISABLE_DEPRECATED_UNDEFED 1

#endif

#include <glib.h>

// Redefine G_DISABLE_DEPRECATED if it was defined before we temporarily undefed it:
#if defined(GLIBMM_G_DISABLE_DEPRECATED_UNDEFED)
#define G_DISABLE_DEPRECATED 1
#undef GLIB_DISABLE_DEPRECATION_WARNINGS
#undef GLIBMM_G_DISABLE_DEPRECATED_UNDEFED
#endif


comment:7 Changed 8 years ago by dbevans (David B. Evans)

I haven't completely wrapped my head around the precise mechanism of failure and why it recently changed. However, glibmm and inkscape are conceptually at odds in that glibmm is configured to build with deprecated API enabled for backwards compatibility but inkscape builds with it's "strict" build by default which means enabling the following in CPPFLAGS:

-DG_DISABLE_DEPRECATED -DGLIBMM_DISABLE_DEPRECATED -DGDKMM_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGTKMM_DISABLE_DEPRECATED

As far as inciting event goes, in addition to the recent update to glib2, gtkmm was recently updated so that may be an effect as well.

In any case, disabling the +strict variant allows inkscape to build without error (for me at least).

comment:8 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

If you look up higher in glibmm/threads.h, you'll notice that the entire file is wrapped in #ifndef GLIBMM_DISABLE_DEPRECATED, so given the -DGLIBMM_DISABLE_DEPRECATED on the command line, all that should be getting skipped. I need to trace all the includes to figure out why we're not just bypassing that deprecated code.

comment:9 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Summary: inkscape fails to build due to glibmm inlining, regression caused by glib2 changesinkscape fails to build due to glibmm / glib2 deprecation misconfiguration

comment:10 Changed 8 years ago by ob+macport@…

Cc: ob+macport@… added

Cc Me!

comment:11 Changed 8 years ago by larryv (Lawrence Velázquez)

Cc: stott@… fleason@… added
Port: inkscape-devel added

Has duplicates #52371 and #52375.

comment:12 Changed 8 years ago by fleason (Fred Leason)

Cc: fleason@… removed

Cc Me!

comment:13 Changed 8 years ago by fleason (Fred Leason)

Cc: fleason@… added

Cc Me!

comment:14 Changed 8 years ago by WolfgangFahl (Wolfgang Fahl)

sudo port clean inkscape
sudo port install inkscape-strict

works for me

comment:15 Changed 8 years ago by dbevans (David B. Evans)

Yes, the problem is with the +strict variant which builds with deprecations disabled. As of r152704, +strict is no longer the default build so this should work for you as well

sudo port selfupdate
sudo port install inkscape

You now have to explicitly use

sudo port install inkscape +strict

to observe the failure reported here.

Last edited 8 years ago by dbevans (David B. Evans) (previous) (diff)

comment:16 Changed 8 years ago by dbevans (David B. Evans)

Summary: inkscape fails to build due to glibmm / glib2 deprecation misconfigurationinkscape +strict fails to build due to glibmm / glib2 deprecation misconfiguration

comment:17 Changed 8 years ago by dbevans (David B. Evans)

Summary: inkscape +strict fails to build due to glibmm / glib2 deprecation misconfigurationinkscape, inkscape-devel +strict fails to build due to glibmm / glib2 deprecation misconfiguration

This also occurs with inkscape-devel. Patched in r153847 to disable +strict as the default build as previously done in inkscape. This allows both inkscape and inkscape-devel default builds to succeed. The underlying issue remains however. To demonstrate problem build +strict variant.

comment:18 Changed 8 years ago by Schamschula (Marius Schamschula)

Cc: mps@… added

Cc Me!

comment:19 Changed 8 years ago by dbevans (David B. Evans)

Has additional duplicate #52899

comment:20 Changed 8 years ago by astrofitz (Michael Fitzgerald)

Cc: astrofitz added

comment:21 Changed 3 years ago by mascguy (Christopher Nielsen)

Owner: changed from dbevans to mascguy

Take over Dave's tickets for GTK and friends, now that he's formally dropped maintainership. Boo! ;-)

comment:22 Changed 3 years ago by cooljeanius (Eric Gallager)

Cc: cooljeanius added

comment:23 Changed 3 years ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: assignedclosed

Since this port has now been updated to 1.1.2, please let us know if this is still an issue.

If so, we'll reopen.

Note: See TracTickets for help on using tickets.