GNOME Bugzilla – Bug 770541
Build Failure against GNOME 3.21.x
Last modified: 2016-09-07 09:51:03 UTC
GNOTE 3.21.0 fails to build on the openSUSE BuildService in the GNOME 3.21.x staging project: [ 97s] CXX backlinksnoteaddin.lo [ 97s] ITMRG backlinks.desktop [ 99s] In file included from ../../../src/noteaddin.hpp:38:0, [ 99s] from backlinksnoteaddin.hpp:27, [ 99s] from backlinksnoteaddin.cpp:25: [ 99s] ../../../src/note.hpp: In member function 'bool gnote::Note::has_buffer() const': [ 99s] ../../../src/note.hpp:127:14: error: cannot convert 'const Glib::RefPtr<gnote::NoteBuffer>' to 'bool' in return [ 99s] return m_buffer; [ 99s] ^~~~~~~~ [ 99s] ../../../src/note.hpp: In member function 'bool gnote::Note::is_loaded() const': [ 99s] ../../../src/note.hpp:142:23: error: cannot convert 'const Glib::RefPtr<gnote::NoteBuffer>' to 'bool' in return [ 99s] return (m_buffer); [ 99s] ^ [ 100s] make[4]: *** [Makefile:534: backlinksnoteaddin.lo] Error 1 [ 100s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnote-3.21.0/src/addins/backlinks' [ 100s] make[3]: *** [Makefile:452: all-recursive] Error 1 [ 100s] make[3]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnote-3.21.0/src/addins' [ 100s] make[2]: *** [Makefile:1391: all-recursive] Error 1 [ 100s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnote-3.21.0/src' [ 100s] make[1]: *** [Makefile:485: all-recursive] Error 1 [ 100s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/gnote-3.21.0' [ 100s] make: *** [Makefile:417: all] Error 2
CCing Murray - the changes in glibmm seem to be responsible here Things the no longer works: Glib::RefPtr<NoteBuffer> m_buffer; bool has_buffer() const { return m_buffer; /* implicit conversion to bool /* } This is likely a side effect of https://git.gnome.org/browse/glibmm/commit/?id=aee3a6fa6a37e1178b43437966b4225a34f9c6e2 what works (but is ugly): Glib::RefPtr<NoteBuffer> m_buffer; bool has_buffer() const { if (m_buffer) return true; else return false; /* explicit conversion to bool /* } There are a couple similar things like failing furher down in the build of gnote, where this fails: gnote::DepthNoteTag::Ptr depth = get_buffer()->find_depth_tag(p_start); if(depth != 0) { /* do stuff *? }
notewindow.cpp:207:29: error: no match for ‘operator!=’ (operand types are ‘Glib::RefPtr<Gdk::Window>’ and ‘int’) if(parent->get_window() != 0 According to the unstable doc, this should still be valid: https://developer.gnome.org/glibmm/unstable/classGlib_1_1RefPtr.html#ade68fc2a3cdb54e51b0f136aee95c074
Created attachment 334553 [details] [review] Fix build (it's rather crude - but so far in my tests seems to work) has_buffer and is_loaded both expect to return a bool, so returning plain m_buffer won't cut it Fixes build error [ 89s] In file included from ../../../src/noteaddin.hpp:38:0, [ 89s] from backlinksnoteaddin.hpp:27, [ 89s] from backlinksnoteaddin.cpp:25: [ 89s] ../../../src/note.hpp: In member function 'bool gnote::Note::has_buffer() const': [ 89s] ../../../src/note.hpp:127:14: error: cannot convert 'const Glib::RefPtr<gnote::NoteBuffer>' to 'bool' in return [ 89s] return m_buffer; [ 89s] ^~~~~~~~ [ 89s] ../../../src/note.hpp: In member function 'bool gnote::Note::is_loaded() const': [ 89s] ../../../src/note.hpp:142:23: error: cannot convert 'const Glib::RefPtr<gnote::NoteBuffer>' to 'bool' in return [ 89s] return (m_buffer);
This is intentional. You really shouldn't be relying on implicit conversions to bool, or to an int. I guess that a simple explicit (bool) will do what you want. For instance: bool has_buffer() const { return (bool)m_buffer; }
(In reply to Murray Cumming from comment #4) > This is intentional. You really shouldn't be relying on implicit conversions > to bool, or to an int. I guess that a simple explicit (bool) will do what > you want. For instance: > > bool has_buffer() const > { > return (bool)m_buffer; > } For the bool case that indeed works (and is a bit nice that whatever I wrote) - will update the patch and re-attach
Created attachment 334559 [details] [review] Changes the if (m_buffer) return true; else return false; constructs to return (bool)m_buffer; much cleaner again
(In reply to Dominique Leuenberger from comment #2) > notewindow.cpp:207:29: error: no match for ‘operator!=’ (operand types are > ‘Glib::RefPtr<Gdk::Window>’ and ‘int’) > if(parent->get_window() != 0 > > According to the unstable doc, this should still be valid: > > https://developer.gnome.org/glibmm/unstable/classGlib_1_1RefPtr. > html#ade68fc2a3cdb54e51b0f136aee95c074 The link goes to bool Glib::RefPtr<T_CppObject>::operator!=(const RefPtr<T_CppObject>& src) const showing that it's possible to compare two Glib::RefPtr<>s for inequality. parent->get_window() != 0 is not a comparison between two Glib::RefPtr<>s. Just like the error message says, it's a comparison between a Glib::RefPtr<Gdk::Window> and an int. That kind of comprison was possible when Glib::RefPtr could be implicitly converted to bool, which was then implicitly converted to int. In this case I think it would be possible to write if(parent->get_window()) because a conversion to bool in such a test is considered explicit.
(In reply to Kjell Ahlstedt from comment #7) > In this case I think it would be possible to write > if(parent->get_window()) > because a conversion to bool in such a test is considered explicit. Indeed, and this is also what the patch I attached actually does
Comment on attachment 334553 [details] [review] Fix build (it's rather crude - but so far in my tests seems to work) Rejecting this in favor of the other patch.
This problem has been fixed in the unstable development version. The fix will be available in the next major software release. You may need to upgrade your Linux distribution to obtain that newer version.