Launchpad has imported 6 comments from the remote bug at
https://bugs.gnucash.org/show_bug.cgi?id=798156.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2021-03-31T20:21:13+00:00 Thomas Klausner wrote:

There is a breaking change in glib 2.68.0:

https://bugzilla.redhat.com/show_bug.cgi?id=1926239
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1935#note_1034039

In short, the glib headers cannot be included in ``extern "C"'' any
longer.

This breaks gnucash 4.4 and 4.5. A lot of error output, looking
basically like this:


In file included from /usr/pkg/include/glib-2.0/glib/gatomic.h:31,
                 from /usr/pkg/include/glib-2.0/glib/gthread.h:32,
                 from /usr/pkg/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/pkg/include/glib-2.0/glib.h:32,
                 from 
/scratch/finance/gnucash/work/gnucash-4.5/libgnucash/engine/SchedXaction.h:42,
                 from 
/scratch/finance/gnucash/work/gnucash-4.5/gnucash/gnome/assistant-loan.cpp:33:
/usr/include/g++/type_traits:3024:3: error: template with C linkage
 3024 |   template<typename _Tp>
      |   ^~~~~~~~
/scratch/finance/gnucash/work/gnucash-4.5/gnucash/gnome/assistant-loan.cpp:26:1:
 note: 'extern "C"' linkage started here
   26 | extern "C"
      | ^~~~~~~~~~

The glib includes are sometimes in other includes - here in
SchedXAction.h, so it's not easy to see what needs to be moved.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1923642/comments/0

------------------------------------------------------------------------
On 2021-04-01T01:11:21+00:00 Jralls wrote:

Rats. assistant_loan.cpp was modified as part of
https://github.com/Gnucash/gnucash/pull/912 for this exact problem, but
Bill put the glib include after the extern "C" block so it gets included
first from SchedXAction.h. We had to do a bunch more to get CI tests to
pass on Arch Linux as it had picked up the changes in the meantime.

It's obvious what to do, but I'm a bit curious about why it works on
Arch but still fails for you. Are you perhaps building with clang?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1923642/comments/1

------------------------------------------------------------------------
On 2021-04-01T07:46:08+00:00 Thomas Klausner wrote:

No clang, that's with gcc 9.3.0.
I tried turning off aqbanking, ofx, dbi but that didn't help.
I'm not sure what the difference is, sorry.

I played around a bit and found a diff that made it compile on my
system:

--- gnucash/gnome/assistant-loan.cpp.orig       2021-03-26 23:08:11.000000000 
+0000
+++ gnucash/gnome/assistant-loan.cpp
@@ -23,6 +23,10 @@
  * Boston, MA  02110-1301,  USA       g...@gnu.org                   *
 \********************************************************************/
 
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
 extern "C"
 {
 #include <config.h>
@@ -50,9 +54,6 @@ extern "C"
 #endif
 }
 
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gtk/gtk.h>
 #include <gnc-locale-utils.hpp>
 #include <boost/locale.hpp>
 #include <string>


I guess glib's multiple-inclusion-protection in the header saves us here :)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1923642/comments/2

------------------------------------------------------------------------
On 2021-04-01T15:47:01+00:00 Jralls wrote:

> I guess glib's multiple-inclusion-protection in the header saves us
here :)

Exactly. It's also what kills us when #include <glib.h> is after the
extern "C" block.

Interesting as well that fixing this one instance gets GnuCash to build:
There are several more in the original commit.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1923642/comments/3

------------------------------------------------------------------------
On 2021-04-01T16:02:00+00:00 Thomas Klausner wrote:

Sorry, that's the one I need on top of gnucash 4.5.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1923642/comments/4

------------------------------------------------------------------------
On 2021-04-20T18:05:58+00:00 Jralls wrote:

Fixed for 4.6. I've moved all of the includes from PR 912.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/gnucash/+bug/1923642/comments/10


** Changed in: gnucash
       Status: Unknown => Fix Released

** Changed in: gnucash
   Importance: Unknown => Critical

** Bug watch added: Red Hat Bugzilla #1926239
   https://bugzilla.redhat.com/show_bug.cgi?id=1926239

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1923642

Title:
  glib can no longer be included in extern "C" blocks

To manage notifications about this bug go to:
https://bugs.launchpad.net/gnucash/+bug/1923642/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to