Bug 51654

Summary: kdemultimedia build error with kernel 2.5.47
Product: [Unmaintained] kscd Reporter: Laurence Withers <lwithers>
Component: generalAssignee: Aaron J. Seigo <aseigo>
Status: RESOLVED NOT A BUG    
Severity: normal CC: ismail, l, zaz
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Laurence Withers 2002-12-08 20:11:27 UTC
Version:            (using KDE KDE 3.0.99)
Installed from:    Compiled From Sources
Compiler:          gcc 3.2.1 
OS:          Linux

I am using kernel 2.5.47 (and the 'asm' and 'linux' symlinks are in place in the include directory). I have a build problem with the kdemultimedia package in general - not just kscd - but I couldn't see how to report the bug against kdemultimedia build.

The output from gcc (v3.2.1) is:
-----------------------------------------------------
In file included from /usr/local/include/linux/cdrom.h:14,
                 from cdromAccess_Linux.cpp:17,
                 from cdromAccess.cpp:26:
/usr/local/include/asm/byteorder.h:38: syntax error before `(' token
/usr/local/include/asm/byteorder.h:42: '__u64' is used as a type, but is not
   defined as a type.
/usr/local/include/asm/byteorder.h:43: parse error before `}' token
/usr/local/include/asm/byteorder.h:44: syntax error before `.' token
/usr/local/include/asm/byteorder.h:50: syntax error before `.' token
/usr/local/include/asm/byteorder.h:51: syntax error before `.' token
/usr/local/include/asm/byteorder.h:52: parse error before `:' token
In file included from /usr/local/include/linux/byteorder/little_endian.h:11,
                 from /usr/local/include/asm/byteorder.h:65,
                 from /usr/local/include/linux/cdrom.h:14,
                 from cdromAccess_Linux.cpp:17,
                 from cdromAccess.cpp:26:
/usr/local/include/linux/byteorder/swab.h:158: syntax error before `(' token
/usr/local/include/linux/byteorder/swab.h:168: syntax error before `(' token
/usr/local/include/linux/byteorder/swab.h:172: `__u64' was not declared in this
   scope
/usr/local/include/linux/byteorder/swab.h:172: `addr' was not declared in this
   scope
/usr/local/include/linux/byteorder/swab.h:173: variable or field `__swab64s'
   declared void
/usr/local/include/linux/byteorder/swab.h:173: `__swab64s' declared as an
   `inline' variable
/usr/local/include/linux/byteorder/swab.h:173: syntax error before `{' token
-----------------------------------------------------

It seems that this happens because of the following code (taken from asm/types.h):
-----------------------------------------------------
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
typedef __signed__ long long __s64;
typedef unsigned long long __u64;
#endif
-----------------------------------------------------

When compiling with the -ansi switch, the __u64 type is undefined, which causes the errors listed above. I don't know whether this is an issue with the kernel headers or with kdemultimedia, but the solution is simple: remove the -ansi switch from the compiler flags and it works perfectly.

Please let me know if there are any tests/etc I can do to help.
Comment 1 Ismail Donmez 2002-12-23 12:54:50 UTC
I have like 3-4 patches for KdeMultimedia which fixes 2.5 kernel issues . I 
will upload them when I can get home.

Actually the problem you mentioned can be resolved by adding

typedef unsigned long long __u64;

ANSI doesnt support long long thats why it fails :)
Comment 2 Aaron J. Seigo 2002-12-29 08:54:53 UTC
a matter of passing the correct flags to the compiler ... look forward to the 2.5 patches 
(perhaps when 2.5 is nearing completion so as not to make unecessary changes?) 
Comment 3 Ismail Donmez 2002-12-29 10:04:21 UTC
Errr 2.5 kernel is not broken. You better open the bug again . Because kernel wont define a 
long long variable unless you cut off -ansi or explicitly define it. 
Comment 4 Aaron J. Seigo 2002-12-29 10:22:07 UTC
since it is a matter of passing the right compiler flags and happens with a devel kernel, i 
don't consider this a kscd bug. ergo its closed. i've mailed core-devel re: -ansi and the 2.5 
kernel. 
 
btw, i never said 2.5 was broken. i was referring to the 2.5 patches you have and noting 
that it may not be the wisest move to put patches in CVS HEAD for a kernel that has only 
recently moved into feature freeze. 
Comment 5 Laurence Withers 2003-07-31 16:13:05 UTC
Please note that this same error occurs with GCC 3.3 and kernel 2.4.21. The 
-ansi switch causes the preprocessor symbol __STRICT_ANSI__ to be defined, 
which in turn causes the section 
 
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) 
typedef unsigned long long __u64 
#endif 
 
from /usr/include/asm/types.h (a Linux kernel header) to not be compiled. 
 
It occurs in the subdirectories `kscd/libwm' and `mpeglib/lib/input', and can 
be solved by editing the Makefiles in said directories to remove all 
occurrences of the `-ansi' flag. 
Comment 6 Thiago Macieira 2003-07-31 17:32:19 UTC
*** Bug 61892 has been marked as a duplicate of this bug. ***
Comment 7 Sergey Manucharyan 2003-12-04 13:57:13 UTC
It's not good idea to remove -ansi flags from the Makefile-s. 
Somebody put them for some purposes.
The correct solution is to apply the patch suggested by Niki Guldbrand <niki@lunar-linux.org> to the kernel. After that everything works fine.

===========================================================================

--- old/include/asm-i386/byteorder.h    2003-06-13 16:51:38.000000000 +0200
+++ new/include/asm-i386/byteorder.h    2003-09-08 20:59:43.000000000 +0200
@@ -34,7 +34,7 @@
                return x;
 }
 
-
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
 static inline __u64 ___arch__swab64(__u64 val) 
 { 
        union { 
@@ -55,10 +55,11 @@
 } 
 
 #define __arch__swab64(x) ___arch__swab64(x)
+#define __BYTEORDER_HAS_U64__
+#endif
 #define __arch__swab32(x) ___arch__swab32(x)
 #define __arch__swab16(x) ___arch__swab16(x)
 
-#define __BYTEORDER_HAS_U64__
 
 #endif /* __GNUC__ */

==================================================
Comment 8 Ismail Donmez 2003-12-04 19:45:45 UTC
This is already fixed.
Comment 9 Tomas 2004-10-19 08:56:28 UTC
I tried to compile kdemultimedia 3.3.1, it fails without the kernel patch (I'm using kernel headers 2.4.27)