Bug#879071: 0ad FTBFS with on armhf with gcc 7: error: call of overloaded 'abs(unsigned int)' is ambiguous
peter green
plugwash at p10link.net
Sun Nov 19 12:38:35 UTC 2017
Jumping straight to removing an architecture from the architecture list and filing a removal request over a build failure with no evidence of an attempt at a fix and no attempt to bring it up with the porters is not in line with "Packages must be supported on as many architectures as is reasonably possible".
I decided to take a look at actually fixing this bug.
It seems that the cause is the signedness of wchar_t. It appears that on arm linux wchar_t is unsigned whereas on x86 linux wchar_t is signed.
The result is that on arm linux the subtraction produces an unsigned result. The standard libary has no abs functions for unsigned types and so you get the ambiguous call error.
Casting both arguments of the subtraction to int fixes the error.
Debdiff attatched, no immediate intent to NMU.
-------------- next part --------------
diff -Nru 0ad-0.0.22/debian/changelog 0ad-0.0.22/debian/changelog
--- 0ad-0.0.22/debian/changelog 2017-11-04 10:04:26.000000000 +0000
+++ 0ad-0.0.22/debian/changelog 2017-11-19 02:03:24.000000000 +0000
@@ -1,3 +1,12 @@
+0ad (0.0.22-3.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Add armhf back to architecture list.
+ * Fix "0ad FTBFS with on armhf with gcc 7: error: call of overloaded
+ 'abs(unsigned int)' is ambiguous" (Closes: #879071)
+
+ -- Peter Michael Green <plugwash at debian.org> Sun, 19 Nov 2017 02:03:24 +0000
+
0ad (0.0.22-3) unstable; urgency=medium
* remove support of kfreebsd-amd64 and kfreebsd-i386 since auto test fails
diff -Nru 0ad-0.0.22/debian/control 0ad-0.0.22/debian/control
--- 0ad-0.0.22/debian/control 2017-11-04 10:02:10.000000000 +0000
+++ 0ad-0.0.22/debian/control 2017-11-18 14:53:56.000000000 +0000
@@ -35,7 +35,7 @@
Vcs-Browser: https://anonscm.debian.org/viewvc/pkg-games/packages/trunk/0ad/
Package: 0ad
-Architecture: amd64 i386
+Architecture: amd64 i386 armhf
Pre-Depends: dpkg (>= 1.15.6~)
Depends:
0ad-data (>= ${source:Upstream-Version}),
diff -Nru 0ad-0.0.22/debian/patches/armhf-wchar-signedness.patch 0ad-0.0.22/debian/patches/armhf-wchar-signedness.patch
--- 0ad-0.0.22/debian/patches/armhf-wchar-signedness.patch 1970-01-01 00:00:00.000000000 +0000
+++ 0ad-0.0.22/debian/patches/armhf-wchar-signedness.patch 2017-11-19 02:03:24.000000000 +0000
@@ -0,0 +1,34 @@
+Description: fix build failure on armhf due to unsigned wchar_t
+ * Fix "0ad FTBFS with on armhf with gcc 7: error: call of overloaded
+ 'abs(unsigned int)' is ambiguous" (Closes: #879071)
+ The root cause of this failure is that wchar_t is unsigned on
+ armhf. Subtracting a signed 32-bit number from an unsigned one results
+ in an unsigned result which std::abs (understandablly) does not support.
+ Casting both arguments of the subtraction to int fixes the build failure
+Author: Peter Michael Green <plugwash at debian.org>
+Bug-Debian: https://bugs.debian.org/879071
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: 2017-11-19
+
+--- 0ad-0.0.22.orig/source/gui/CDropDown.cpp
++++ 0ad-0.0.22/source/gui/CDropDown.cpp
+@@ -352,7 +352,7 @@ InReaction CDropDown::ManuallyHandleEven
+ int diff = 0;
+ for (size_t j = 0; j < m_InputBuffer.length(); ++j)
+ {
+- diff = std::abs(pList->m_Items[i].GetRawString().LowerCase()[j] - (int)m_InputBuffer[j]);
++ diff = std::abs((int)(pList->m_Items[i].GetRawString().LowerCase()[j]) - (int)m_InputBuffer[j]);
+ if (diff == 0)
+ indexOfDifference = j+1;
+ else
diff -Nru 0ad-0.0.22/debian/patches/series 0ad-0.0.22/debian/patches/series
--- 0ad-0.0.22/debian/patches/series 2017-10-18 15:02:57.000000000 +0000
+++ 0ad-0.0.22/debian/patches/series 2017-11-19 02:03:24.000000000 +0000
@@ -1,3 +1,4 @@
enable-hardening-relro.patch
allow-build-with-root.patch
fix-bindir.patch
+armhf-wchar-signedness.patch
More information about the Pkg-games-devel
mailing list