Comment 0 for bug 6784

Revision history for this message
In , Petter Reinholdtsen (pere-hungry) wrote :

Package: sysklogd
Version: 1.4.1-14
Severity: serious
Tags: patch

The latest sysklogd source fail to build on s390. This keep the
latest version from propagating into sarge, and make the bug a serious
problem.

The problem is in the new module.h, where hte atomic_t type is missing
when including <asm/atomic.h> on s390 and hppa. This is the build
error from s390 (identical to the one on hppa):

 gcc -O2 -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DSYSV
   -fomit-frame-pointer -fno-strength-reduce -DFSSTND -c ksym_mod.c
  In file included from ksym_mod.c:97:
  module.h:65: error: parse error before "atomic_t"
  module.h:65: warning: no semicolon at end of struct or union
  module.h:65: warning: no semicolon at end of struct or union
  module.h:67: error: parse error before '}' token
  module.h:67: warning: type defaults to `int' in declaration of `uc'
  module.h:67: warning: data definition has no type or storage class
  module.h:90: error: parse error before '}' token
  ksym_mod.c:144: error: field `module' has incomplete type
  ksym_mod.c: In function `AddModule':
  ksym_mod.c:418: error: invalid application of `sizeof' to an incomplete type
  make[1]: *** [ksym_mod.o] Error 1

I had a look on raptor.debian.org, and there I discovered that the
problem is that everything in <asm/atomic.h> is protected by #ifdef
__KERNEL__, including the atomic_t type.

Making sure to define __KERNEL__ before including <asm/atomic.h> fixed
the build problem on s390. This might not be safe on all other archs.
Here is a patch against sysklogd 1.4.1-14 to do that:

diff -ur sysklogd-1.4.1/module.h sysklogd-1.4.1-pere/module.h
--- sysklogd-1.4.1/module.h 2004-04-23 17:28:43.000000000 +0200
+++ sysklogd-1.4.1-pere/module.h 2004-04-23 17:29:03.000000000 +0200
@@ -28,6 +28,7 @@
  * recent content from Linux 2.4/2.6.
  */

+#define __KERNEL__ /* get it compiling on s390 */
 #include <asm/atomic.h>

 #define MODULE_NAME_LEN (64 - sizeof(unsigned long))

Another approach is to change the s390 kernel headers to be more like
the other archs. I checked on i386, and there the <asm/atomic.h>
header isn't protected by #ifdef __KERNEL__.

Here is a patch against linux-kernel-headers version
2.5.999-test7-bk-15. It will also fix the problem.

--- /usr/include/asm/atomic.h.orig 2003-10-15 17:10:24.000000000 +0200
+++ /usr/include/asm/atomic.h 2004-04-23 17:31:26.000000000 +0200
@@ -1,7 +1,6 @@
 #ifndef __ARCH_S390_ATOMIC__
 #define __ARCH_S390_ATOMIC__

-#ifdef __KERNEL__
 /*
  * include/asm-s390/atomic.h
  *
@@ -193,5 +192,4 @@
 #define smp_mb__before_atomic_inc() smp_mb()
 #define smp_mb__after_atomic_inc() smp_mb()

-#endif /* __KERNEL__ */
 #endif /* __ARCH_S390_ATOMIC__ */