Bug 374196 - Build failure on compiling kio_trash
Summary: Build failure on compiling kio_trash
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.29.0
Platform: Other Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks: 373932
  Show dependency treegraph
 
Reported: 2016-12-27 07:45 UTC by Ralf Habacker
Modified: 2017-01-01 11:54 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.30.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Habacker 2016-12-27 07:45:12 UTC
After applying the required patch to fix bug 374166 I get the following compile error:
[ 70%] Building CXX object src/kssld/CMakeFiles/kssld.dir/kssld.cpp.obj
cd /home/abuild/rpmbuild/BUILD/kio-5.29.0/build/src/kssld && /usr/bin/i686-w64-mingw32-g++   -DKCOREADDONS_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_NETWORK_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER -DTRANSLATION_DOMAIN=\"kio5\" -DUNICODE -DWIN32_LEAN_AND_MEAN -DWINVER=0x0600 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D_USE_MATH_DEFINES -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0600 -Dkssld_EXPORTS @CMakeFiles/kssld.dir/includes_CXX.rsp -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -DNDEBUG -fno-stack-protector -std=c++0x -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -pedantic -fvisibility=hidden -fno-keep-inline-dllexport   -o CMakeFiles/kssld.dir/kssld.cpp.obj -c /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/kssld/kssld.cpp
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/kio_trash_win.cpp:26:27: fatal error: kiotrashdebug.h: No such file or directory
[  230s]  #include "kiotrashdebug.h"
[  230s]                            ^
[  230s] compilation terminated.
Comment 1 David Faure 2016-12-27 17:55:40 UTC
Is this with -j or something? kssld has nothing to do with kio_trash.

As to the kio_trash_win.cpp error, isn't there a kiotrashdebug.h in the same source dir? Is -I. missing somehow?

Hmm I do spot an error in the CMakeLists.txt though...
Comment 2 David Faure 2016-12-27 17:56:45 UTC
Git commit 76f89c46d8645eec53795b26f1af7d669cea2c50 by David Faure.
Committed on 27/12/2016 at 17:56.
Pushed by dfaure into branch 'master'.

Fix CMakeLists.txt for windows, blindly, since the windows guys report bugs instead of committing fixes ;-)

M  +1    -1    src/ioslaves/trash/CMakeLists.txt

https://commits.kde.org/kio/76f89c46d8645eec53795b26f1af7d669cea2c50
Comment 3 Ralf Habacker 2016-12-27 18:17:53 UTC
(In reply to David Faure from comment #1)
> Is this with -j or something? kssld has nothing to do with kio_trash.

build log without any -j follows:

make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/kio-5.29.0/build'
[ 68%] Building CXX object src/ioslaves/trash/CMakeFiles/kio_trash.dir/kio_trash_win.cpp.obj
cd /home/abuild/rpmbuild/BUILD/kio-5.29.0/build/src/ioslaves/trash && /usr/bin/i686-w64-mingw32-g++   -DKCOREADDONS_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER -DQT_XML_LIB -DTRANSLATION_DOMAIN=\"kio5\" -DUNICODE -DWIN32_LEAN_AND_MEAN -DWINVER=0x0600 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D_USE_MATH_DEFINES -D_WIN32_IE=0x0600 -D_WIN32_WINNT=0x0600 -Dkio_trash_EXPORTS @CMakeFiles/kio_trash.dir/includes_CXX.rsp -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -DNDEBUG -fno-stack-protector -std=c++0x -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -pedantic -fvisibility=hidden -fno-keep-inline-dllexport   -o CMakeFiles/kio_trash.dir/kio_trash_win.cpp.obj -c /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/kio_trash_win.cpp
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/kio_trash_win.cpp:26:27: fatal error: kiotrashdebug.h: No such file or directory
 #include "kiotrashdebug.h"
                           ^   
> As to the kio_trash_win.cpp error, isn't there a kiotrashdebug.h in the same
> source dir? Is -I. missing somehow?

in kio 5.29 source there is no kiotrashdebug.
Comment 4 Ralf Habacker 2016-12-27 18:38:15 UTC
(In reply to Ralf Habacker from comment #3)
> in kio 5.29 source there is no kiotrashdebug.h
KIO_TRASH is defined in trashimpl.h
./src/ioslaves/trash/trashimpl.h:31:Q_DECLARE_LOGGING_CATEGORY(KIO_TRASH), so the fix is to include trashimpl.h instead of kiotrashdebug.h
Comment 5 Ralf Habacker 2016-12-27 19:04:56 UTC
(In reply to David Faure from comment #2)
> Git commit 76f89c46d8645eec53795b26f1af7d669cea2c50 by David Faure.
> Committed on 27/12/2016 at 17:56.
> Pushed by dfaure into branch 'master'.
> 
> Fix CMakeLists.txt for windows, blindly, since the windows guys report bugs
> instead of committing fixes ;-)

Unfortunally I'm not familiar with the kio windows implementation yet, so there is currently only a bug report.

> M  +1    -1    src/ioslaves/trash/CMakeLists.txt
> 
> https://commits.kde.org/kio/76f89c46d8645eec53795b26f1af7d669cea2c50

With this patch I get:

/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp: In constructor 'TrashImpl::TrashImpl()':
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:74:60: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(QFile::encodeName(QDir::homePath()), &buff) == 0) {
                                                            ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp: In member function 'bool TrashImpl::createInfo(const QString&, int&, QString&)':
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:269:46: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(origPath_c.data(), &buff_src) == -1) {
                                              ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp: In member function 'bool TrashImpl::del(int, const QString&)':
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:608:38: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(info_c.data(), &buff) == -1) {
                                      ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp: In member function 'int TrashImpl::findTrashDirectory(const QString&)':
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1012:52: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(QFile::encodeName(origPath), &buff) == 0
                                                    ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp: In member function 'QString TrashImpl::trashForMountPoint(const QString&, bool) const':
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1140:5: error: 'uid_t' was not declared in this scope
     uid_t uid = getuid();
     ^~~~~
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1142:39: error: 'S_ISVTX' was not declared in this scope
     const unsigned int requiredBits = S_ISVTX; // Sticky bit required
                                       ^~~~~~~
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1143:39: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(rootTrashDir_c, &buff) == 0) {
                                       ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1145:42: error: 'S_ISLNK' was not declared in this scope
                 && (!S_ISLNK(buff.st_mode)) // not a symlink
                                          ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1150:88: error: 'uid' was not declared in this scope
             const QString trashDir = rootTrashDir + QLatin1Char('/') + QString::number(uid);
                                                                                        ^~~
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1176:83: error: 'uid' was not declared in this scope
     const QString trashDir = topdir + QLatin1String("/.Trash-") + QString::number(uid);
                                                                                   ^~~
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1178:35: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(trashDir_c, &buff) == 0) {
                                   ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1181:42: error: 'S_ISLNK' was not declared in this scope
                 && (!S_ISLNK(buff.st_mode)) // not a symlink
                                          ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp: In member function 'bool TrashImpl::initTrashDirectory(const QByteArray&) const':
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1214:31: error: too many arguments to function 'int mkdir(const char*)'
     if (mkdir(trashDir_c, 0700) != 0) {
                               ^
In file included from /usr/i686-w64-mingw32/sys-root/mingw/share/qt5/mkspecs/win32-g++/qplatformdefs.h:49:0,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/core/udsentry.h:29,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/build/src/core/kio/udsentry.h:1,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/core/statjob.h:25,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/core/jobclasses.h:26,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/core/job.h:74,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/build/src/core/kio/job.h:1,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.h:23,
                 from /home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:22:
/usr/i686-w64-mingw32/sys-root/mingw/include/direct.h:59:15: note: declared here
   int __cdecl mkdir(const char *_Path) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
               ^~~~~
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1220:5: error: 'uid_t' was not declared in this scope
     uid_t uid = getuid();
     ^~~~~
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1222:35: error: 'QT_LSTAT' was not declared in this scope
     if (QT_LSTAT(trashDir_c, &buff) != 0) {
                                   ^
/home/abuild/rpmbuild/BUILD/kio-5.29.0/src/ioslaves/trash/trashimpl.cpp:1225:25: error: 'uid' was not declared in this scope
     if ((buff.st_uid == uid)  // must be owned by user
                         ^~~

Looks like class TrashImpl seems not to be ported to windows or is not intended to be used on windows.
I tried locally to declare/define KIO_TRASH logging category in kio_trash_win.h|.cpp and am be able to compile kio_trash.
Comment 6 David Faure 2016-12-28 10:21:02 UTC
Try including <qplatformdefs.h>
Comment 7 Ralf Habacker 2016-12-28 11:53:03 UTC
(In reply to David Faure from comment #6)
> Try including <qplatformdefs.h>
This is already included in the build 

Looking at git log it seems that kiotrashdebug.h has been included with commit d5bf2083ee2e6d92de14f46ccad54ed125d1fc40 by Hannah von Reth, which has be to applied to 5.29 for similar support.

> https://commits.kde.org/kio/76f89c46d8645eec53795b26f1af7d669cea2c50
This commit needs to be reverted because it breaks windows builds
Comment 8 David Faure 2016-12-28 12:50:14 UTC
Oh I see, none of the "common" files are used on Windows. The var name is misnamed and confusing. I'll rename and revert.
Comment 9 David Faure 2016-12-28 12:51:46 UTC
Git commit ccb616e73292f97b3b22fea3c42fda24b5aff08e by David Faure.
Committed on 28/12/2016 at 12:51.
Pushed by dfaure into branch 'master'.

Revert 76f89c4, and remove some confusion about what this var is for by renaming+moving it.

M  +10   -10   src/ioslaves/trash/CMakeLists.txt

https://commits.kde.org/kio/ccb616e73292f97b3b22fea3c42fda24b5aff08e
Comment 10 Ralf Habacker 2016-12-29 10:52:42 UTC
(In reply to David Faure from comment #2)
> Fix CMakeLists.txt for windows, blindly

There is no need to fix issues blindly. Amy package at https://build.opensuse.org/project/show/home:rhabacker:branches:windows:mingw:win32:KF529 can by build local on a linux host using osc the opensuse build service command line client.