GNOME Bugzilla – Bug 781947
Build fails on MacOS because glib doesn't have gdesktopinfo.
Last modified: 2017-08-15 16:58:16 UTC
glib skips building and installing gdesktopinfo.c when it detects building for Cocoa.
Created attachment 350741 [details] [review] Use the logic copied from glib/configure.ac to determine the presence of Cocoa and conditionally compile desktopappinfo.cpp based on the result. You may want to rework the configure test a bit to match the style of other tests.
Bug #780309 is the glib item about loss of gdesktopinfo.c in recent glib on OS X.
Thanks. Please push if you have git commit access. If you late notice that the MacOS build of glib becomes simpler, please mention it here so we can improve this in glibmm too.
Comment on attachment 350741 [details] [review] Use the logic copied from glib/configure.ac to determine the presence of Cocoa and conditionally compile desktopappinfo.cpp based on the result. Pushed to glibmm-2-50 and master.
This problem has been fixed in our software repository. The fix will go into the next software release. Once that release is available, you may want to check for a software upgrade provided by your Linux distribution.
Bug #781548 gives a ./configure flag to make gdesktopinfo.c optionally available on OS X (as well as several other platorm-specific vs linux/generic APIs). Can glibmm probe glib directly rather than use an indirect platform test?
No, a patch attached to Bug 781548 will provide a configure option to do that *if a GLib developer accepts the patch and commits it*, at which point it will have a commit hash that you can cite to say that it's provided. But yes, the test could check for the presence of gio/gdesktopappinfo.h and/or a library function check for g_desktop_app_info_get_type() instead, and such a test would be more robust that the current one.
It seems that the necessary changes were not introduced into giomm/wrap_init.cc as desktopappinfo is excluded only on Win32, and not on macOS. On my Mac I get the following compilation errors: CXX wrap_init.lo CXX contenttype.lo CXX init.lo CXX slot_async.lo CXX socketsource.lo CXXLD libgiomm-2.4.la Undefined symbols for architecture x86_64: "Gio::DesktopAppInfo::get_type()", referenced from: Gio::wrap_init() in wrap_init.o "Gio::DesktopAppInfo_Class::wrap_new(_GObject*)", referenced from: Gio::wrap_init() in wrap_init.o ld: symbol(s) not found for architecture x86_64
wrap_init.cc is a generated file. It seems that the first patch wasn't sufficient to generate the correct exceptions in the tarball. Were you building from a tarball (which one?) or from git?
tarball: glibmm 2.52.0
Created attachment 354832 [details] [review] Patch: Gio: Exclude DesktopAppInfo from wrap_init.cc on MacOS This patch shows how wrap_init.cc can be fixed. It's a quick and dirty patch. I don't like it, for several reasons. 1. The result of the test in glib should be available outside glib. It's bad that other modules have to repeat the same configure test. See bug 780309 comment 24. 2. If we must have our own configure test, it should be an m4 macro in an m4 file, invoked from configure.ac. Like several other configure tests. 3. AC_TRY_CPP is used in the test. AC_TRY_CPP is deprecated in favour of AC_PREPROC_IFELSE.
It doesn't seem as if the result of glib's test for MacOS will be available to glibmm any time soon. I have pushed a slightly modified version of the patch in comment 11, where I've added some comments in configure.ac and replaced AC_TRY_CPP with AC_PREPROC_IFELSE to avoid a warning from autogen.sh. I have pushed the patch to both the master and glibmm-2-52 branches. Hope it's OK. It affects only builds for MacOS, where glibmm could not be built at all previously, unless I have misunderstood. If it's not ok to make such a change in glibmm-2-52, feel free to revert the commit.