Skip to contentSkip to conversation

package/setools: fix buid without wchar

PATCH New Yann E. MORIN 3 participants 3 messages Aug 13, 2015 – Aug 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/setools: fix buid without wchar

Fixes:

    http://autobuild.buildroot.org/results/051/051a7f72ebadd56407700c22b57e942f08eb1c09/
    http://autobuild.buildroot.org/results/a4b/a4b2a6f1920430af43c23239de17200e70951b3b/
    ...
Cc Matt Weber <[email protected]>
Cc Clayton Shotwell <[email protected]>
---
 package/setools/0003-no-wchar-needed.patch | 45 ++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/setools/0003-no-wchar-needed.patch
package/setools/0003-no-wchar-needed.patch new file +45 -0
new file mode 100644
index 0000000..8b9ea9f
@@ -0,0 +1,45 @@
+configure: do not use wchar_t in tests
+
+setools does not use widechars for itself, so should build on toolchains
+missing widechars (uClibc).
+
+Unfortunately, one of the m4 macros does use wchar_t to check C99,
+completely unrelated to widechar support, thus making it believe C99 is
+not available in the compiler:
+
+    http://autobuild.buildroot.org/results/051/051a7f72ebadd56407700c22b57e942f08eb1c09/build-end.log
+
+    configure:4899: checking for /home/peko/autobuild/instance-1/output/host/usr/bin/powerpc-linux-gcc option to accept ISO C99
+    [--skip test without flags--]
+    configure:5048: /home/peko/autobuild/instance-1/output/host/usr/bin/powerpc-linux-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
+    conftest.c:69:9: error: unknown type name 'wchar_t'
+       const wchar_t *name;
+             ^
+    conftest.c: In function 'main':
+    conftest.c:146:5: warning: initialization from incompatible pointer type
+         .name = L"Test wide string",
+         ^
+
+Thus, just remove any widechar from the test.
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+
+diff -durN setools-3.3.8.orig/m4/c.m4 setools-3.3.8/m4/c.m4
+--- setools-3.3.8.orig/m4/c.m4	2013-01-16 17:36:22.000000000 +0100
++++ setools-3.3.8/m4/c.m4	2015-08-13 21:37:35.795071941 +0200
+@@ -157,7 +157,6 @@
+ 
+ struct named_init {
+   int number;
+-  const wchar_t *name;
+   double average;
+ };
+ 
+@@ -231,7 +230,6 @@
+   // Check named initializers.
+   struct named_init ni = {
+     .number = 34,
+-    .name = L"Test wide string",
+     .average = 543.34343,
+   };
+ 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 package/setools: fix buid without wchar

Hi Yann,

Quoted 38 lines · Yann E. MORIN

Fixes:

    http://autobuild.buildroot.org/results/051/051a7f72ebadd56407700c22b57e942f08eb1c09/
    http://autobuild.buildroot.org/results/a4b/a4b2a6f1920430af43c23239de17200e70951b3b/
    ...
Cc Matt Weber <[email protected]>
Cc Clayton Shotwell <[email protected]>
---
 package/setools/0003-no-wchar-needed.patch | 45 ++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/setools/0003-no-wchar-needed.patch
package/setools/0003-no-wchar-needed.patch new file +19 -0
new file mode 100644
index 0000000..8b9ea9f
@@ -0,0 +1,45 @@
+configure: do not use wchar_t in tests
+
+setools does not use widechars for itself, so should build on toolchains
+missing widechars (uClibc).
+
+Unfortunately, one of the m4 macros does use wchar_t to check C99,
+completely unrelated to widechar support, thus making it believe C99 is
+not available in the compiler:
+
+    http://autobuild.buildroot.org/results/051/051a7f72ebadd56407700c22b57e942f08eb1c09/build-end.log
+
+    configure:4899: checking for /home/peko/autobuild/instance-1/output/host/usr/bin/powerpc-linux-gcc option to accept ISO C99
+    [--skip test without flags--]
+    configure:5048: /home/peko/autobuild/instance-1/output/host/usr/bin/powerpc-linux-gcc -std=gnu99 -c -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64   -Os  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 conftest.c >&5
+    conftest.c:69:9: error: unknown type name 'wchar_t'
+       const wchar_t *name;
+             ^
+    conftest.c: In function 'main':
+    conftest.c:146:5: warning: initialization from incompatible pointer type

package/setools/0003-no-wchar-needed.patch line 29

Quoted 10 lines
package/setools/0003-no-wchar-needed.patch new file +10 -0
+         .name = L"Test wide string",
+         ^
+
+Thus, just remove any widechar from the test.
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+
+diff -durN setools-3.3.8.orig/m4/c.m4 setools-3.3.8/m4/c.m4
+--- setools-3.3.8.orig/m4/c.m4	2013-01-16 17:36:22.000000000 +0100
++++ setools-3.3.8/m4/c.m4	2015-08-13 21:37:35.795071941 +0200

The _AUTORECONF comment needs an update.

Quoted 5 lines
package/setools/0003-no-wchar-needed.patch new file +5 -0
+@@ -157,7 +157,6 @@
+ 
+ struct named_init {
+   int number;
+-  const wchar_t *name;

package/setools/0003-no-wchar-needed.patch line 44

Quoted 10 lines
package/setools/0003-no-wchar-needed.patch new file +10 -0
+   double average;
+ };
+ 
+@@ -231,7 +230,6 @@
+   // Check named initializers.
+   struct named_init ni = {
+     .number = 34,
+-    .name = L"Test wide string",
+     .average = 543.34343,
+   };

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 package/setools: fix buid without wchar

In reply to Yann E. MORIN

Yann,

Quoted 19 lines · Yann E. MORIN

Fixes:

    http://autobuild.buildroot.org/results/051/051a7f72ebadd56407700c22b57e942f08eb1c09/
    http://autobuild.buildroot.org/results/a4b/a4b2a6f1920430af43c23239de17200e70951b3b/
    ...
Cc Matt Weber <[email protected]>
Cc Clayton Shotwell <[email protected]>
---
 package/setools/0003-no-wchar-needed.patch | 45 ++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/setools/0003-no-wchar-needed.patch
package/setools/0003-no-wchar-needed.patch new file +0 -0
new file mode 100644
index 0000000..8b9ea9f

package/setools/0003-no-wchar-needed.patch line 8

Quoted 8 lines
package/setools/0003-no-wchar-needed.patch new file +8 -0
@@ -0,0 +1,45 @@
+configure: do not use wchar_t in tests
+
+setools does not use widechars for itself, so should build on toolchains
+missing widechars (uClibc).
+
+Unfortunately, one of the m4 macros does use wchar_t to check C99,
+completely unrelated to widechar support, thus making it believe C99 is
+not available in the compiler:

I am not really fan of this change. This c.m4 file is in fact copy/pasted (partially) from the autoconf sources themselves, where the same macro does test for wchar support as part of the C99 test.

Therefore, I'm a bit reluctant to change this macro originating from the autoconf sources, and I think we should instead just make the package depend on wchar support.

It is not clear whether C99 requires wchar support or not, I couldn't find a very clear statement about this. But the implementation of this macro, which explicitly includes <wchar.h> and uses a wide string initializer, seems to say so. If not, can you raise the problem to the autoconf developers?

In the mean time, a patch making setools only available for wchar-capable toolchains would be preferred. In general, if there is no easily upstreamable solution to avoid a toolchain dependency, I prefer to have the toolchain dependency than a non-upstreamable patch. Especially for "big" stuff like SELinux, that are unlikely to be used in a non-wchar enabled configuration.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com