GNOME Bugzilla – Bug 795138
gobject build failure with gcc <= 4.7
Last modified: 2018-04-20 10:33:41 UTC
Created attachment 370739 [details] [review] Patch fixing issue On powerpc, we got the following error: /home/uffo8396/buildroot/output/host/bin/../powerpc-buildroot-linux-gnuspe/sysroot/usr/include/glib-2.0/gobject/gobject.h:725:5: error: value computed is not used [-Werror=unused-value] This error has been added by commit https://github.com/GNOME/glib/commit/3fae39a5d742afe73741f5fd7aa24e3ae8182f06 The patch put back old behavior if __powerpc__ is defined Fixes: - http://autobuild.buildroot.net/results/b29a2f868438a2210873ea72f491db63175848be
I don't see GLib defining -Werror=unused-value... Are you adding it? If so, why not just stop doing that? I'm not sure I see how KOing the feature on a specific architecture is the correct answer. Can you explain why it is?
-Wall is added by the tpm2-abrmd package (which is using glib): https://github.com/tpm2-software/tpm2-abrmd/blob/0313bfdeccddc7e02b36861ca1b50be9837f1382/configure.ac I agree that disabling the feature for a specific architecture is not the perfect solution however I don't think that removing -Wall from tpm2-abrmd (and all other glib packages that could use glib) is better. I will wait from feedback of the other buildroot members perhaps they will find an explanation on why this breaks (only) on powerpc.
Well, it's not the -Wall that's the immediate issue; it's the unspecific -Werror.
Yes, that's the combination of -Wall and -Werror. I will suggest to remove -Werror from tpm2-abrmd package and hope that other glib packages won't have the same issue.
(In reply to Fabrice Fontaine from comment #4) > Yes, that's the combination of -Wall and -Werror. I will suggest to remove > -Werror from tpm2-abrmd package and hope that other glib packages won't have > the same issue. In any case, the fix of ignoring the typeof cast on PowerPC is wrong: the warning comes from GCC only on PPC, so it points to a compiler issue. There's no annotation on g_object_ref() that you must use the returned value, and adding a cast on the return value should not magically add a requirement on using the returned value. I'd strongly encourage you to file a bug against GCC.
After more investigations (http://lists.busybox.net/pipermail/buildroot/2018-April/218914.html), it seems that this issue is indeed due to GCC. So, will you accept a patch that enable this definition only if GCC version is above or equal to 4.8?
We don't usually work around compiler bugs that way. On the other hand, we do have a bunch of conditional macro definition for ancient GCC versions, even though we don't have CI set up to test that we're not actually breaking stuff, so we could make this conditional to GCC ≥ 4.8. Feel free to attach a patch — and re-open the bug when you do so. I'll be happy to review it.
Created attachment 370873 [details] [review] Second patch (replacing former one)
Thanks for your answer, I attached a new patch
Review of attachment 370873 [details] [review]: OK, thanks.
Pushed to master and backported to glib-2-56: b93788ac1 (HEAD -> master, origin/master, origin/HEAD) gobject: fix compilation with gcc <= 4.7 8de72c56a (HEAD -> glib-2-56) gobject: fix compilation with gcc <= 4.7