2010-12-25 02:17, Andriy Rysin skrev:
2010/12/24 Andreas Pakulat<ap...@gmx.de>

On 24.12.10 16:06:54, Erik wrote:
kcm_keyboard 4.5.4 fails to build

Steps to reproduce:
1. tar jxvf /usr/portage/distfiles/kdebase-workspace-4.5.4.tar.bz2
2. cd kdebase-workspace-4.5.4
3. mkdir build
4. cd build
5. cmake -DKDE4_ENABLE_FINAL=ON ..
6. make kcm_keyboard

Actual result:
In file included from /usr/include/qt4/QtCore/QDir:1,
                   from

/home/work/programmering/kdebase-workspace-4.5.4/kcontrol/keyboard/xkb_helper.cpp:22,
                   from

/home/work/programmering/kdebase-workspace-4.5.4/build/kcontrol/keyboard/kcm_keyboard_final_cpp.cpp:8:
/usr/include/qt4/QtCore/qdir.h:107: fel: expected identifier before
numeric constant
/usr/include/qt4/QtCore/qdir.h:107: fel: expected "}" before numeric
constant
/usr/include/qt4/QtCore/qdir.h:107: fel: expected unqualified-id before
numeric constant
Note that for most of the errors you posted you won't get much help here
I think. The reason is that this list is mostly concerned with
development-questions when using KDE code. If you find such build
problems you're probably better of finding the maintainer of the
relevant bit of code (svn blame or a README file) and talk to those
people directly.

I hope by "maintainer of relevant bit of code" you mean "maintainer of
qdir.h", as I am the maintainer of kcm_keyboard and I have not idea why it
breaks in FINAL mode. :) I guess some includes are messed up/missing with
FINAL=ON but I am afraid it'll take somebody who really knows what FINAL
mode is to help with this.

Final mode is no magic at all. It just compiles a file that includes all cc/cpp files. I looked at qdir.h, and the problematic piece is this:
    enum SortFlag { Name        = 0x00,
                    Time        = 0x01,
                    Size        = 0x02,
                    Unsorted    = 0x03,
                    SortByMask  = 0x03,

                    DirsFirst   = 0x04,
                    Reversed    = 0x08,
                    IgnoreCase  = 0x10,
                    DirsLast    = 0x20,
                    LocaleAware = 0x40,
                    Type        = 0x80,
                    NoSort = -1
#ifdef QT3_SUPPORT
                  ,DefaultSort = NoSort
#endif
    };


Then I used
    cmake -DKDE4_ENABLE_FINAL=ON -DCMAKE_VERBOSE_MAKEFILE=ON ..
to see the build command, and modified it to only preprocess the source. Then I searched for "enum SortFlag" in the preprocessor output. There I found this:
    enum SortFlag { Name = 0x00,
                    Time = 0x01,
                    Size = 0x02,
                    0 = 0x03,
                    SortByMask = 0x03,

                    DirsFirst = 0x04,
                    Reversed = 0x08,
                    IgnoreCase = 0x10,
                    DirsLast = 0x20,
                    LocaleAware = 0x40,
                    Type = 0x80,
                    NoSort = -1



    };



So for some reason Unsorted was substituted with 0 during preprocessing. I see traces of other people finding the same issue and trying to work around it:
$ grep "#undef Unsorted" -r kdebase-workspace-4.5.4
kdebase-workspace-4.5.4/kcontrol/krdb/krdb.cpp:#undef Unsorted
kdebase-workspace-4.5.4/kcontrol/kdm/background/bgsettings.cpp:#undef Unsorted
kdebase-workspace-4.5.4/kcontrol/fonts/fonts.cpp:#undef Unsorted

I notice that the occurence in kdebase-workspace-4.5.4/kcontrol/kdm/background/bgsettings.cpp has the comment "Clean up after X.h/Xlib.h". I look what that means:
$ grep Unsorted /usr/include/X11/ -r
/usr/include/X11/X.h:#define Unsorted           0

So obviously X.org pollutes the namespace. I was able to fix the build with the attached patch.
diff -ru kdebase-workspace-4.5.4/kcontrol/keyboard/x11_helper.cpp.orig 
kdebase-workspace-4.5.4/kcontrol/keyboard/x11_helper.cpp
--- kdebase-workspace-4.5.4/kcontrol/keyboard/x11_helper.cpp    2010-09-30 
23:20:14.000000000 +0200
+++ 
/home/work/programmering/kdebase-workspace-4.5.4/kcontrol/keyboard/x11_helper.cpp
   2010-12-25 07:42:24.628000182 +0100
@@ -27,6 +27,9 @@
 #include <X11/Xatom.h>
 #include <X11/XKBlib.h>
 #include <X11/extensions/XKBrules.h>
+// clean up after X.h/Xlib.h
+#undef Bool
+#undef Unsorted
 
 
 // more information about the limit 
https://bugs.freedesktop.org/show_bug.cgi?id=19501
diff -ru kdebase-workspace-4.5.4/kcontrol/keyboard/xinput_helper.cpp 
kdebase-workspace-4.5.4/kcontrol/keyboard/xinput_helper.cpp
--- kdebase-workspace-4.5.4/kcontrol/keyboard/xinput_helper.cpp 2010-09-30 
23:20:14.000000000 +0200
+++ 
/home/work/programmering/kdebase-workspace-4.5.4/kcontrol/keyboard/xinput_helper.cpp
        2010-12-25 07:51:18.672999713 +0100
@@ -31,6 +31,10 @@
 #include <X11/extensions/XInput.h>
 #endif
 
+// clean up after X.h/Xlib.h
+#undef Bool
+#undef Unsorted
+
 #include "x11_helper.h"
 
 
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to