Bug 162084

Summary: compile error when using old gcc
Product: [Unmaintained] plasma4 Reporter: nihui <shuizhuyuanluo>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED INTENTIONAL    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: fix the errors when using gcc3
fix build r821791 update patch

Description nihui 2008-05-14 12:39:42 UTC
Version:            (using Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.4.6 
OS:                Linux

hi,

I reported such issus some days ago.
http://bugs.kde.org/show_bug.cgi?id=161877

and r806698 fix that.

but that fix caused another two compilation errors, just the same kind of error like the previous bug.

this time, I uploaded a patch written by myself.
It will move these functions from protected to public.
I passed the compilation after using the patch.

output info when trying to build svn807659:

[nihui@MagicLinux plasma]$ make -j6
[  0%] [  0%] [  0%] [  0%] [  0%] [  0%] Building CXX object libs/plasma/CMakeFiles/plasma.dir/corona.o
Building CXX object libs/plasma/CMakeFiles/plasma.dir/dataengine.o
Building CXX object libs/plasma/CMakeFiles/plasma.dir/delegate.o
Building CXX object libs/plasma/CMakeFiles/plasma.dir/runnermanager.o
Building CXX object libs/plasma/CMakeFiles/plasma.dir/view.o
Building CXX object libs/plasma/CMakeFiles/plasma.dir/scripting/appletscript.o
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/runnermanager.cpp: In member function `void Plasma::RunnerManager::Private::loadAll()':
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/abstractrunner.h:192: error: `Plasma::AbstractRunner::AbstractRunner(QObject*, const QString&)' is protected
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/runnermanager.cpp:256: error: within this context
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/dataengine.cpp: In member function `void Plasma::DataEngine::Private::internalUpdateSource(Plasma::DataContainer*)':
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/datacontainer.h:127: error: `uint Plasma::DataContainer::timeSinceLastUpdate() const' is protected
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/dataengine.cpp:444: error: within this context
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/datacontainer.h:137: error: `void Plasma::DataContainer::setNeedsUpdate(bool)' is protected
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/dataengine.cpp:450: error: within this context
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/runnermanager.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/delegate.cpp: In member function `virtual void Plasma::Delegate::paint(QPainter*, const QStyleOptionViewItem&, const QModelIndex&) const':
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/delegate.cpp:326: warning: converting to `int' from `double'
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/dataengine.o] Error 1
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/corona.cpp: In member function `Plasma::Containment* Plasma::Corona::Private::addContainment(const QString&, const QVariantList&, uint, bool)':
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/applet.h:556: error: `void Plasma::Applet::setFailedToLaunch(bool, const QString&)' is protected
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/corona.cpp:153: error: within this context
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/applet.h:602: error: `void Plasma::Applet::setIsContainment(bool)' is protected
/work/people/nihui/mBuild/BUILD/kdebase-workspace-4.0.73/libs/plasma/corona.cpp:157: error: within this context
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/corona.o] Error 1
make[1]: *** [libs/plasma/CMakeFiles/plasma.dir/all] Error 2
make: *** [all] Error 2
Comment 1 nihui 2008-05-14 12:40:43 UTC
Created attachment 24760 [details]
fix the errors when using gcc3

move these functions to public.
Comment 2 nihui 2008-05-23 17:16:36 UTC
4.0.80(KDE 4.1 beta1)

this problem seems to disappear  ;)
Comment 3 nihui 2008-06-17 14:18:45 UTC
sorry for my last change of this bug report.

I have to say that this problem still persists in the last svn trunk snapshot(4.0.82).
So I reopen this.

my patch can be applied to recover these errors.

ps: amarok2 is also affected since it use the same code.

nihui @ #kde-devel #plasma ........
Comment 4 nihui 2008-06-19 03:04:53 UTC
4.0.83(svn 821791)
errors still exist...
but after applying the patch, it works.

Any responses?

(using make -j4)
[ 75%] Building CXX object libs/plasma/CMakeFiles/plasma.dir/dataenginemanager.o
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/dataengine.cpp: In member function `void Plasma::DataEngine::Private::internalUpdateSource(Plasma::DataContainer*)':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/datacontainer.h:127: error: `uint Plasma::DataContainer::timeSinceLastUpdate() const' is protected
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/dataengine.cpp:451: error: within this context
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/datacontainer.h:137: error: `void Plasma::DataContainer::setNeedsUpdate(bool)' is protected
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/dataengine.cpp:457: error: within this context
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/dataengine.cpp: At global scope:
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/dataengine.cpp:70: warning: unused parameter 'source'
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/dataengine.o] 错误 1
make[2]: *** 正在等待未完成的任务....
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/corona.cpp: In member function `Plasma::Containment* Plasma::Corona::Private::addContainment(const QString&, const QVariantList&, uint, bool)':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/applet.h:591: error: `void Plasma::Applet::setFailedToLaunch(bool, const QString&)' is protected
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/corona.cpp:135: error: within this context
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/applet.h:642: error: `void Plasma::Applet::setIsContainment(bool)' is protected
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/corona.cpp:139: error: within this context
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/corona.o] 错误 1
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp: In member function `QPoint Plasma::Containment::effectiveScreenPos() const':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:646: warning: passing `qreal' for converting 1 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:649: warning: passing `qreal' for converting 1 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:649: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:652: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:655: warning: passing `qreal' for converting 1 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:655: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp: In member function `KActionCollection& Plasma::Containment::Private::actions()':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/applet.h:746: error: `Plasma::Applet::Private* const Plasma::Applet::d' is private
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:943: error: within this context
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp: In member function `void Plasma::Containment::Private::positionContainment()':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:1336: warning: converting to `int' from `qreal'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:1360: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/containment.o] 错误 1
make[1]: *** [libs/plasma/CMakeFiles/plasma.dir/all] 错误 2
make: *** [all] 错误 2


(using make)
[ 41%] Building CXX object libs/plasma/CMakeFiles/plasma.dir/containment.o
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp: In member function `QPoint Plasma::Containment::effectiveScreenPos() const':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:646: warning: passing `qreal' for converting 1 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:649: warning: passing `qreal' for converting 1 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:649: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:652: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:655: warning: passing `qreal' for converting 1 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:655: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp: In member function `KActionCollection& Plasma::Containment::Private::actions()':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/applet.h:746: error: `Plasma::Applet::Private* const Plasma::Applet::d' is private
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:943: error: within this context
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp: In member function `void Plasma::Containment::Private::positionContainment()':
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:1336: warning: converting to `int' from `qreal'
/work/people/nihui/mBuild/SOURCES/kdebase-workspace-4.0.83/libs/plasma/containment.cpp:1360: warning: passing `qreal' for converting 2 of `QPoint::QPoint(int, int)'
make[2]: *** [libs/plasma/CMakeFiles/plasma.dir/containment.o] 错误 1
make[1]: *** [libs/plasma/CMakeFiles/plasma.dir/all] 错误 2
make: *** [all] 错误 2
Comment 5 nihui 2008-06-19 03:33:27 UTC
Created attachment 25451 [details]
fix build r821791 update patch

patch updated to r821791.
Comment 6 Andreas Pakulat 2008-06-19 09:27:21 UTC
Two notes:

a) I don't think the patch is correct, I doubt the author of the code wants to see these functions as public.

b) this is the wrong place for compile errors. You should send this to panel-devel@kde.org
Comment 7 nihui 2008-06-19 11:02:34 UTC
To Andreas Pakulat,
a) I created the patch just for passing the compilation, and I hadn't considered more. Since these functions were moved to private during the Plasma api review, I'm certainly aware of that the author of the code should have his reasons and private functions should have their advantages. 
If my patch isn't correct, then please tell me what should I do with these errors. Better solution is always welcome.

b) One of the plasma team members suggested me to report these problems in a separate bug report.(see comment #5  https://bugs.kde.org/show_bug.cgi?id=161877)
Besides, each comment in the bug reports related to plasma will be sent to panel-devel mailinglist automatically.

thanks anyway.
Comment 8 Andreas Pakulat 2008-06-19 11:30:20 UTC
ad a) I don't have any idea about the code, so I can't help there. But having a quick look at the code I wonder wether adding a "friend class DataEngine::Private;" line under the friend class declaration helps?

ad b) I thought the general rule is that compilation problems shouldn't be here, but I couldn't find a page saying so. So maybe thats not a general rule. Anyway, comments to bugreports for plasma aren't automatically sent to the panel-devel list anymore as that caused too much noise there. so only stuff assigned to "Plasma Dev Team" like this bugreport will.
Comment 9 Aaron J. Seigo 2008-06-23 00:52:49 UTC
yes, this patch is wrong. if you want to fix it properly, then go through and change all the classes called Private to <ClassName>Private, move them outside the class declaration (so they aren't inner classes) and change all ClassName::Private to ClassNamePrivate.

while i'll certainly accept such a patch, i'm not actually interested in doing this work myself or by any of the other plasma devs who already have enough to do.

use a decent compiler.
Comment 10 nihui 2008-06-23 03:49:04 UTC
so, do you mean lib/plasma *won't* be able to be compiled when using old gcc without a patch?
and KDE 4.1.x *won't* be able to be compiled either....
while KDE 4.0.x can.    :|

If that's true, then I think you devs should announce this info to the release-team and drop the "gcc 3.x" in "compilation requirement" section on the techbase page.

gcc 3.x is too old to compile plasma in KDE 4.1  ~~
Comment 11 Aaron J. Seigo 2008-06-23 04:34:43 UTC
that's what i'm saying. unless someone who actually uses gcc 3.x bothers to do the work necessary, it won't happen.

i've heard of this issue a number of times and yet the people who report it won't spend the couple of hours it would take to fix it for everyone else as well.

free software is about scratching your itches, not me scratching yours. and in this case, using a compiler released in the last year or two fixes the problem so i'm not going to put this on our TODO.

if you care about it, fix it.
Comment 12 nihui 2008-07-05 05:35:25 UTC
Comment on attachment 25451 [details]
fix build r821791 update patch

wrong
Comment 13 nihui 2008-07-05 05:35:55 UTC
4.0.85 snapshot: seems to have been fixed.

http://websvn.kde.org/?view=rev&revision=826893

Thank you all the devs !