GNOME Bugzilla – Bug 587149
aix5 and aix6 xlC (at least) cannot compile libgnomeuimm
Last modified: 2018-08-17 19:28:34 UTC
libgnomeuimm-2.16.0 was compilable on xlC on aix 5.1, 5.2, 5.3 and 6.1. libgnomeuimm-2.22.0 and libgnomeuimm-2.26.0 are not. This part of libgnomeui/libgnomeuimm/ui-items-stock.h (around 150): #define STOCK_MENU(X,Y) \ struct X : public Items::Menu \ { \ X(const Items::Array<Info>& tree = Items::Array<Info>()) \ : Items::Menu(Y,tree) \ {} \ ~X() \ {} \ } causes the compiler to throw an error at each invocation of STOCK_MENU, thus: "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 153.1: 1540-1280 (S) An rvalue of type "Gnome::UI::Items::Array<Gnome::UI::Items::Info>" cannot be converted to "const Gnome::UI::Items::Array<Gnome::UI::Items::Info> &". "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 153.1: 1540-1291 (I) To initialize the reference with an rvalue, "class Array<Gnome::UI::Items::Info>" must have a copy constructor with a parameter of type "const Gnome::UI::Items::Array<Gnome::UI::Items::Info> &". I would have tested with more compilers, but due to compilation failures because of bugs #586934 and #586889, I cannot build the dependencies except with gcc-4.1 or better.
I doubt there are any changes in the actual libgnomeui code since 2.16.0. Or have you found any?
Created attachment 137493 [details] [review] fix one compilation error for xlC on aix This allows xlC to compile on aix-6.1, at the expense of leaking memory for each stock menu item instantiation. aix-5.1, 5.2 and 5.3 also get further, but choke on a different file later on.
with the above patch applied, this part of libgnomeui/libgnomeuimm/app-helper.h (around line 281): // determine number of Items for (I b2 = b ; b2 != e; ++b2, ++size_) { if (b2->type() == Info::END) break; } causes the following error: "../../libgnomeui/libgnomeuimm/app-helper.h", line 281.11: 1540-0217 (S) "type" is not a member of "class Array<Gnome::UI::Items::Info>". "../../libgnomeui/libgnomeuimm/app-helper.h", line 268.1: 1540-0700 (I) The previous message was produced while processing "Gnome::UI::Items::Array<Gnome::UI::Items::Info>::create<const Gnome::UI::Items::Array<Gnome::UI::Items::Info> *>(const Array<Gnome::UI::Items::Info> *, const Array<Gnome::UI::Items::Info> *)". "../../libgnomeui/libgnomeuimm/app-helper.h", line 231.5: 1540-0700 (I) The previous message was produced while processing "Gnome::UI::Items::Array<Gnome::UI::Items::Info>::Array(Array<Gnome::UI::Items::Info> * const &)". "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 160.12: 1540-0700 (I) The previous message was produced while processing "struct Gnome::UI::Menus::Windows". "../../libgnomeui/libgnomeuimm/app-helper.h", line 286.8: 1540-0217 (S) "type" is not a member of "class Array<Gnome::UI::Items::Info>". "../../libgnomeui/libgnomeuimm/app-helper.h", line 298.5: 1540-0270 (S) An object of type "Gnome::UI::Items::Info" cannot be constructed from an lvalue of type "const Gnome::UI::Items::Array<Gnome::UI::Items::Info>".
Murray, yes you're right. I misread our package build logs, and the last successful build of libgnomeuimm on aix5.[123] was version 2.10.0. We didn't have aix-6.1 back then, though I'm sure it would have been able to build libgnomeuimm-2.10.0 just as well as aix5.x.
So did you identify any changes in the code since 2.10 that could have caused this?
It looks as though it is updates to the AIX compilers since we built 2.10.0 that have started raising an error at this line of code. I'm pretty sure the patch I've attached isn't the right fix (aside from it causing a leak), since this line in 2.26.0 is no different to the equivalent line in 2.10.0. I am not familiar enough with C++ syntax to understand why you can't initialise a const reference like this, and have no clue as to how to phrase this line of code to make it acceptable to xlC. None-the-less, being able to compile code with more than one compiler is a laudable goal... especially with C++ which doesn't allow mixing of libraries from different compilers. Of course, I'll be happy to test any potential fixes you can suggest.
(In reply to comment #2) > Created an attachment (id=137493) [edit] > fix one compilation error for xlC on aix > > This allows xlC to compile on aix-6.1, at the expense of leaking memory for > each stock menu item instantiation. aix-5.1, 5.2 and 5.3 also get further, but > choke on a different file later on. The addition of new there is definitely wrong. Does it help to do this instead?: - X(const Items::Array<Info>& tree = Items::Array<Info>()) \ + X(Items::Array<Info> tree = Items::Array<Info>()) \
(In reply to comment #3) > "../../libgnomeui/libgnomeuimm/app-helper.h", line 281.11: 1540-0217 (S) "type" > is not a member of "class Array<Gnome::UI::Items::Info>". That's the code inside the loop here: for (I b2 = b ; b2 != e; ++b2, ++size_) { if (b2->type() == Info::END) break; } For some reason it thinks b2 is a Array<Gnome::UI::Items::Info> instead of a Gnome::UI::Items::Info. I wonder if it would help to use this syntax template <class T_Info, class I> void Array<T_Info>::create(I b, I e) instead of template <class T_Info> template <class I> void Array<T_Info>::create(I b, I e) But maybe this error will not even happen with the fix in my previous comment.
(In reply to comment #7) > Does it help to do this instead?: > > - X(const Items::Array<Info>& tree = Items::Array<Info>()) \ > + X(Items::Array<Info> tree = Items::Array<Info>()) \ Still no good, sorry :( Hmm... cannot convert rvalue of type X to type X?!?!? "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 153.1: 1540-1280 (S) An rvalue of type "Gnome::UI::Items::Array<Gnome::UI::Items::Info>" cannot be converted to "Gnome::UI::Items::Array<Gnome::UI::Items::Info>". "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 153.1: 1540-0218 (I) The call does not match any parameter list for "Array<Gnome::UI::Items::Info>::Array<Gnome::UI::Items::Info>". "../../libgnomeui/libgnomeuimm/app-helper.h", line 224.3: 1540-1283 (I) "Gnome::UI::Items::Array<Gnome::UI::Items::Info>::Array(Gnome::UI::Items::Array<Gnome::UI::Items::Info> &)" is not a viable candidate. "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 153.1: 1540-0295 (I) A parameter of type "Gnome::UI::Items::Array<Gnome::UI::Items::Info> &" cannot be initialized with an rvalue of type "Gnome::UI::Items::Array<Gnome::UI::Items::Info>". "../../libgnomeui/libgnomeuimm/ui-items-stock.h", line 153.1: 1540-1290 (I) An rvalue cannot be converted to a reference to a non-const type.
Hi Murray, Thanks for the suggestions, but I'm still stuck: (In reply to comment #8) > For some reason it thinks b2 is a Array<Gnome::UI::Items::Info> instead of a > Gnome::UI::Items::Info. I wonder if it would help to use this syntax > > template <class T_Info, class I> > void > Array<T_Info>::create(I b, I e) Even aix-6.1 xlC (which can compile the app-helper.h as shipped) chokes in that case: "../../libgnomeui/libgnomeuimm/app-helper.h", line 267.1: 1540-1174 (S) The member "template void create(I, I)" is not declared as a template in its containing class definition. Also, gcc-4.2.4 rejects this syntax with the error: In file included from ../../libgnomeui/libgnomeuimm/app.h:37, from app.cc:4: ../../libgnomeui/libgnomeuimm/app-helper.h:268: error: prototype for `void Gnome::UI::Items::Array<T_Info>::create(I, I)' does not match any in class `Gnome::UI::Items::Array<T_Info>' ../../libgnomeui/libgnomeuimm/app-helper.h:196: error: candidate is: template<class T_Info> template<class I> void Gnome::UI::Items::Array::create(I, I) ../../libgnomeui/libgnomeuimm/app-helper.h:268: error: template definition of non-template `void Gnome::UI::Items::Array<T_Info>::create(I, I)' Which, I think, are both referring to this code in the same file: // Array converter class template<class T_Info> class Array { //void* operator new (size_t s); // not implemented Info* data_; Info* begin_; int size_; template <class I> void create(I b, I e); Again, I would test with more compilers, but because of bugs #586934 and #586889 I can't even build the libgnomeuimm prerequisites except with gcc-4.1 or better. :(
libgnomeuimm is not under active development anymore since 2009. Its codebase has been archived: https://gitlab.gnome.org/Archive/libgnomeuimm/commits/master Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this ticket (or rather transfer the project to GNOME Gitlab, as GNOME Bugzilla is deprecated) if anyone takes the responsibility for active development again.