On Tuesday 30 March 2010 06:11:44 Michael Deutschmann wrote:
> On Tue, 30 Mar 2010, Natanael Copa wrote:
> > and with m4-1.4.14 i get this:
> >
> > In file included from pipe.c:48:
> > ./spawn.h:112: error: field '_sp' has incomplete type
> > make[3]: *** [pipe.o] Error 1
>
> This sounds like a problem I've had on my own system, which is
> threadless.  So linuxthreads has nothing to do with it.
>
> My local patch to m4, supressing the bug, is appended.  The comment next
> to the conditional I've spiked makes it clear what is going on.
> Apparently, glibc's headers expose the full definition of "struct
> sched_param" in cases not required by the standard, and gnulib attempts to
> optimize based on this. uClibc does not share glibc's behavior in this one
> case, but since it defines __GLIBC__, gnulib sees no need for caution.

That's not actually the problem, although your workaround does work.  (So does 
using struct __sched_param instead of struct sched_param for the _sp definition 
in the struct.)

But the actual problem is that uClibc hasn't got posix_spawn(), thus no 
/usr/include/spawn.h.  In m4's lib/spawn.in.h:

>#if @REPLACE_POSIX_SPAWN@ || !...@have_posix_spawnattr_t@
>typedef struct
>{
>  short int _flags;
>  pid_t _pgrp;
>  sigset_t _sd;
>  sigset_t _ss;
>  struct sched_param _sp;
>  int _policy;
>  int __pad[16];
>} posix_spawnattr_t;
>#endif

./configure sets HAVE_POSIX_SPAWNATTR_T to 1 for glibc, 0 for uClibc.  So this 
chunk of code doesn't get sucked in for glibc (#if 0 || !1) because because 
the struct is defined in /usr/include/spawn.h.  For uClibc (#if 0 || !0) it 
gets sucked in, but never gets triggered due to the if # __GLIBC__ (making it 
work for BSD).

So the fix is either:

1) Don't claim to be glibc.
2) Provide posix_spawn() so it doesn't try to replace it.
3) Patch multiple upstream packages that have copied code from each other.
4) export CFLAGS=-Dsched_param=__sched_param
5) Tweak our bits/sched.h to always provide sched_param when it provides 
__sched_param, which is what the upstream packages seem to expect.

I went with #5, using the attached patch to uClibc.

Rob
-- 
GPLv3: as worthy a successor as The Phantom Menace, as timely as Duke Nukem 
Forever, and as welcome as New Coke.

diff -ru uClibc/libc/sysdeps/linux/common/bits/sched.h uClibc.bak/libc/sysdeps/linux/common/bits/sched.h
--- uClibc/libc/sysdeps/linux/common/bits/sched.h	2010-04-02 10:34:27.000000000 -0500
+++ uClibc.bak/libc/sysdeps/linux/common/bits/sched.h	2010-10-15 13:38:43.000000000 -0500
@@ -61,6 +61,7 @@
 # define CLONE_STOPPED	0x02000000 /* Start in stopped state.  */
 #endif
 
+#undef sched_param
 /* The official definition.  */
 struct sched_param
   {
@@ -82,6 +83,8 @@
 
 __END_DECLS
 
+#else
+#define sched_param __sched_param
 #endif	/* need schedparam */
 
 #if !defined __defined_schedparam \
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to