util-linux: fix ncurses/wchar handling (again)
authorCarlos Santos <casantos@datacom.ind.br>
Sun, 22 Jan 2017 03:15:42 +0000 (01:15 -0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sun, 22 Jan 2017 06:53:24 +0000 (17:53 +1100)
Since commit 006a328ad6bed214ec3c4d92120510ea37329dd1 ("util-linux: fix
build with ncurses"), we have a build failure that occurs with musl and
uClibc-ng toolchains when wide-char support is not enabled in ncurses.

The problem occurs because util-linux #defines its own wchar_t (as char)
when configured without widechar support. It was fixed upstream, so pull
the corresponding patch from the util-linux git repository.

Fixes:
  http://autobuild.buildroot.net/results/3a2f228e0fa7b5cc28a13d49f48f1a6aef8d9d7a
  http://autobuild.buildroot.net/results/99e96069f652d511c6212a5bb6be29e68fb1747c
  http://autobuild.buildroot.net/results/2dc5721aef93b7b410153bafad78248fac3db941
  http://autobuild.buildroot.net/results/8a9e197ba7a292b18f8c0c36dca974685556a38a

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/util-linux/0003-build-sys-fix-compilation-with-ncurses-and-uClibc-or.patch [new file with mode: 0644]

diff --git a/package/util-linux/0003-build-sys-fix-compilation-with-ncurses-and-uClibc-or.patch b/package/util-linux/0003-build-sys-fix-compilation-with-ncurses-and-uClibc-or.patch
new file mode 100644 (file)
index 0000000..2a1e56d
--- /dev/null
@@ -0,0 +1,92 @@
+From 9ea8ded37b648bbd538cbf9c4d144b8b1a93c1b5 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <casantos@datacom.ind.br>
+Date: Thu, 19 Jan 2017 17:27:37 -0200
+Subject: [PATCH] build-sys: fix compilation with ncurses and uClibc or musl
+ libc
+
+Compiling util-linux with musl and uClibc-ng toolchains when wide-char
+support is not enabled in ncurses results in compilation failures with
+the following message:
+
+    error: two or more data types in declaration specifiers
+    #define
+     wchar_t char
+
+The problem occurs because util-linux #defines its own wchar_t (as char)
+when configured without widechar support. This conflicts with definition
+of wchar_t contained in stddef.h.
+
+This error can be reproduced running "<toolchain-cc -o test test.c" with
+the following test program:
+
+    #include <ctype.h>
+    #define wchar_t char
+    #include <stddef.h>
+
+    int main()
+    {
+        return 0;
+    }
+
+The only way to avoid the problem it to reorder the inclusion of headers
+in some files under the text-utils directory.
+
+Addresses:
+  http://autobuild.buildroot.net/results/3a2f228e0fa7b5cc28a13d49f48f1a6aef8d9d7a
+  http://autobuild.buildroot.net/results/99e96069f652d511c6212a5bb6be29e68fb1747c
+  http://autobuild.buildroot.net/results/2dc5721aef93b7b410153bafad78248fac3db941
+  http://autobuild.buildroot.net/results/8a9e197ba7a292b18f8c0c36dca974685556a38a
+
+Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
+---
+ text-utils/colcrt.c | 2 +-
+ text-utils/colrm.c  | 2 +-
+ text-utils/column.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/text-utils/colcrt.c b/text-utils/colcrt.c
+index c6bba4b..346a10f 100644
+--- a/text-utils/colcrt.c
++++ b/text-utils/colcrt.c
+@@ -46,8 +46,8 @@
+ #include <getopt.h>
+ #include "nls.h"
+-#include "widechar.h"
+ #include "c.h"
++#include "widechar.h"
+ #include "closestream.h"
+ /*
+diff --git a/text-utils/colrm.c b/text-utils/colrm.c
+index 9510b72..d474696 100644
+--- a/text-utils/colrm.c
++++ b/text-utils/colrm.c
+@@ -44,9 +44,9 @@
+ #include <unistd.h>
+ #include "nls.h"
+-#include "widechar.h"
+ #include "strutils.h"
+ #include "c.h"
++#include "widechar.h"
+ #include "closestream.h"
+ /*
+diff --git a/text-utils/column.c b/text-utils/column.c
+index 43b3af5..2eb47a3 100644
+--- a/text-utils/column.c
++++ b/text-utils/column.c
+@@ -50,8 +50,8 @@
+ #include <getopt.h>
+ #include "nls.h"
+-#include "widechar.h"
+ #include "c.h"
++#include "widechar.h"
+ #include "xalloc.h"
+ #include "strutils.h"
+ #include "closestream.h"
+-- 
+2.7.4
+