Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2016 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1257b379b911d951b08a2db614db3073 to your computer and use it in GitHub Desktop.
Save anonymous/1257b379b911d951b08a2db614db3073 to your computer and use it in GitHub Desktop.
Build error citing QT3 incompatible with gcc 6.1.1
CXX rdcartslot.lo
In file included from /usr/include/qt3/qdragobject.h:50:0,
from ./rdcartdrag.h:27,
from ./rdpanel_button.h:36,
from rdcartslot.h:41,
from rdcartslot.cpp:30:
/usr/include/qt3/qimage.h: In member function ‘bool QImageTextKeyLang::operator<(const QImageTextKeyLang&) const’:
/usr/include/qt3/qimage.h:61:45: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
{ return key < other.key || key==other.key && lang < other.lang; }
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
rdcartslot.cpp: In member function ‘unsigned int RDCartSlot::SelectCart(const QString&, unsigned int)’:
rdcartslot.cpp:628:39: error: call of overloaded ‘abs(unsigned int)’ is ambiguous
if(::abs(msecs-q->value(1).toInt())<diff) {
^
In file included from /usr/include/c++/6.1.1/cstdlib:75:0,
from /usr/include/c++/6.1.1/ext/string_conversions.h:41,
from /usr/include/c++/6.1.1/bits/basic_string.h:5402,
from /usr/include/c++/6.1.1/string:52,
from /usr/include/qt3/qstring.h:59,
from /usr/include/qt3/qwindowdefs.h:47,
from /usr/include/qt3/qcolor.h:45,
from /usr/include/qt3/qpainter.h:46,
from rdcartslot.cpp:23:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
In file included from /usr/include/c++/6.1.1/ext/string_conversions.h:41:0,
from /usr/include/c++/6.1.1/bits/basic_string.h:5402,
from /usr/include/c++/6.1.1/string:52,
from /usr/include/qt3/qstring.h:59,
from /usr/include/qt3/qwindowdefs.h:47,
from /usr/include/qt3/qcolor.h:45,
from /usr/include/qt3/qpainter.h:46,
from rdcartslot.cpp:23:
/usr/include/c++/6.1.1/cstdlib:185:3: note: candidate: __int128 std::abs(__int128)
abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
^~~
/usr/include/c++/6.1.1/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/6.1.1/cstdlib:172:3: note: candidate: long int std::abs(long int)
abs(long __i) { return __builtin_labs(__i); }
^~~
rdcartslot.cpp:630:43: error: call of overloaded ‘abs(unsigned int)’ is ambiguous
diff=::abs(msecs-q->value(1).toInt());
^
In file included from /usr/include/c++/6.1.1/cstdlib:75:0,
from /usr/include/c++/6.1.1/ext/string_conversions.h:41,
from /usr/include/c++/6.1.1/bits/basic_string.h:5402,
from /usr/include/c++/6.1.1/string:52,
from /usr/include/qt3/qstring.h:59,
from /usr/include/qt3/qwindowdefs.h:47,
from /usr/include/qt3/qcolor.h:45,
from /usr/include/qt3/qpainter.h:46,
from rdcartslot.cpp:23:
/usr/include/stdlib.h:774:12: note: candidate: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^~~
In file included from /usr/include/c++/6.1.1/ext/string_conversions.h:41:0,
from /usr/include/c++/6.1.1/bits/basic_string.h:5402,
from /usr/include/c++/6.1.1/string:52,
from /usr/include/qt3/qstring.h:59,
from /usr/include/qt3/qwindowdefs.h:47,
from /usr/include/qt3/qcolor.h:45,
from /usr/include/qt3/qpainter.h:46,
from rdcartslot.cpp:23:
/usr/include/c++/6.1.1/cstdlib:185:3: note: candidate: __int128 std::abs(__int128)
abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
^~~
/usr/include/c++/6.1.1/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/usr/include/c++/6.1.1/cstdlib:172:3: note: candidate: long int std::abs(long int)
abs(long __i) { return __builtin_labs(__i); }
^~~
Makefile:1145: recipe for target 'rdcartslot.lo' failed
make[1]: *** [rdcartslot.lo] Error 1
@xavery
Copy link

xavery commented May 18, 2016

The error actually happens because of the Rivendell codebase (rdcartslot.cpp:628), not Qt3 itself, which compiles fine with gcc 6.1.1- though I haven't verified if it actually works properly, there's a plethora of warnings. The error occurs because the result of the msecs-q->value(1).toInt() expression is unsigned (because of msecs being unsigned), while ::abs is defined only for signed integer types, so the unsigned result must be converted back to a signed type. This leads to the error, since there are multiple possible conversions : long, long long, and __int128. This couldn't have occurred with older gcc versions, since they defaulted to C++03, which didn't define long long, thus rendering long as the only possible conversion. GCC 6 uses gnu++14 by default. You could probably compile this by explicitly passing -std=gnu++03 (the previous default language standard) to the commandline.

@WoefulDerelict
Copy link

I've not been able to test anything against QT3 as I can't seem to get anything to build against it and GCC 6.1.1. Explicitly passing -std=gnu++03 in the build has no effect. It explodes at the same point with the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment