Bug 191544 - kioslave/file/file_unix.cpp does not compile on opensolaris
Summary: kioslave/file/file_unix.cpp does not compile on opensolaris
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-04 01:29 UTC by tropikhajma
Modified: 2009-11-13 22:28 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
since Solaris doesn't have a d_type, we need this patch (1.41 KB, patch)
2009-10-05 20:54 UTC, Thorsten Hirsch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tropikhajma 2009-05-04 01:29:05 UTC
Version:           4.2.71 (using Devel)
Compiler:          Sun Studio 12 
OS:                Solaris
Installed from:    Compiled sources

building kioslave/file/file_unix.cpp fails on opensolaris with:
...
pkgbuild: [ 54%] Building CXX object kioslave/file/CMakeFiles/kio_file.dir/file_unix.o
pkgbuild: cd /export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/build-kdelibs-4.2.71.svn961800/kioslave/file && /opt/SUNWspro/bin/CC  -library=no%Cstd  -DQT_NO_STL -DQT_NO_CAST_TO_ASCII -D_REENTRANT -DKDE_DEPRECATED_WARNINGS -Dkio_file_EXPORTS -D__EXTENSIONS__ -DSOLARIS -D_REENTRANT -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_PTHREAD_SEMANTICS -DSOLARIS -DSOLARIS10 -DNDEBUG -DNO_DEBUG -D_UNICODE -DUNICODE -D_RWSTD_REENTRANT  -D_XOPEN_SOURCE=500 -D_XPG5  -I/opt/foss/include/stdcxx/ansi -I/opt/foss/include/stdcxx -I/opt/foss/include -D_REENTRANT -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_POSIX_PTHREAD_SEMANTICS -DSOLARIS -DSOLARIS10 -DNDEBUG -DNO_DEBUG -D_UNICODE -DUNICODE -D_RWSTD_REENTRANT  -D_XOPEN_SOURCE=500 -D_XPG5  -I/opt/foss/include/stdcxx/ansi -I/opt/foss/include/stdcxx -I/opt/foss/include -xtarget=pentium4 -m32 -xarch=sse2 -xchip=pentium4 -xcache=8/64/4:256/128/8 -library=no%Cstd -features=anachronisms,except,rtti,export,extensions,nestedaccess,tmplife,tmplrefstatic -instances=global -template=geninlinefuncs -s  -xlang=c99 -xalias_level=compatible -xustr=ascii_utf16_ushort -Qoption ccfe -features=gcc -Qoption ccfe -features=zla -Qoption ccfe ++boolflag:sunwcch=false -mt   -DQT_NO_DEBUG -KPIC -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/build-kdelibs-4.2.71.svn961800/kioslave/file -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kioslave/file -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800 -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/build-kdelibs-4.2.71.svn961800 -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/interfaces -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kio -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kio/bookmarks -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kio/kio -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kio/kfile -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/actions -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/colors -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/config -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/dialogs -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/findreplace -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/fonts -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/icons -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/itemviews -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/jobs -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/kernel -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/paged -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/plotting -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/shortcuts -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/sonnet -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/util -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/widgets -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/windowmanagement -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdeui/xmlgui -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kjs -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/build-kdelibs-4.2.71.svn961800/kjs -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/build-kdelibs-4.2.71.svn961800/kdecore -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/compression -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/config -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/date -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/io -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/jobs -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/kernel -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/network -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/services -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/localization -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/sycoca -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/text -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/util -I/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kdecore/sonnet -I/opt/foss/qt4/include/phonon -I/opt/foss/qt4/include/QtXmlPatterns -I/opt/foss/qt4/include/QtWebKit -I/opt/foss/qt4/include/QtHelp -I/opt/foss/qt4/include/QtAssistant -I/opt/foss/qt4/include/QtDBus -I/opt/foss/qt4/include/QtTest -I/opt/foss/qt4/include/QtUiTools -I/opt/foss/qt4/include/QtScript -I/opt/foss/qt4/include/QtSvg -I/opt/foss/qt4/include/QtXml -I/opt/foss/qt4/include/QtSql -I/opt/foss/qt4/include/QtOpenGL -I/opt/foss/qt4/include/QtNetwork -I/opt/foss/qt4/include/QtDesigner -I/opt/foss/qt4/include/Qt3Support -I/opt/foss/qt4/include/QtGui -I/opt/foss/qt4/include/QtCore -I/opt/foss/qt4/include/Qt -I/opt/foss/qt4/share/mkspecs/default -I/opt/foss/qt4/include -I/usr/X11/include    -D_LARGEFILE64_SOURCE -o CMakeFiles/kio_file.dir/file_unix.o -c /export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kioslave/file/file_unix.cpp
pkgbuild: "/opt/foss/qt4/include/QtCore/qstringmatcher.h", line 91: Warning: Types cannot be declared in anonymous union.
pkgbuild: "/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kioslave/file/file_unix.cpp", line 348: Error: DT_DIR is not defined.
pkgbuild: "/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kioslave/file/file_unix.cpp", line 348: Error: d_type is not a member of dirent.
pkgbuild: "/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kioslave/file/file_unix.cpp", line 349: Error: DT_LNK is not defined.
pkgbuild: "/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/kioslave/file/file_unix.cpp", line 349: Error: d_type is not a member of dirent.
pkgbuild: 4 Error(s) and 1 Warning(s) detected.
pkgbuild: gmake[3]: *** [kioslave/file/CMakeFiles/kio_file.dir/file_unix.o] Error 4
pkgbuild: gmake[3]: Leaving directory `/export/home/test/packages/BUILD/kdelibs-4.2.71.svn961800/build-kdelibs-4.2.71.svn961800'

As stated at http://www.nexenta.org/os/Porting_Codefixes, "The struct dirent definition in solaris does not contain the d_type field.". There's an example how to modify the code, but it was slightly above my knowledge to use it.
Comment 1 Anne-Marie Mahfouf 2009-05-04 10:32:38 UTC
Shouldn't this be sent to
https://mail.kde.org/mailman/listinfo/kde-solaris
instead for a quick fix and pointers?

Also see
http://www.opensolaris.org/os/project/kde/
and ask here.

Then please attach any patch to this bug report if needed.
Comment 2 Thorsten Hirsch 2009-10-05 20:54:43 UTC
Created attachment 37386 [details]
since Solaris doesn't have a d_type, we need this patch
Comment 3 Thorsten Hirsch 2009-10-05 20:57:14 UTC
@hajma: It's based on your patch. (http://opensolaris.org/jive/thread.jspa?threadID=101870&tstart=45)

@dfaure: I've added you to CC, because you were the last one to change this file. I'll also send you another patch I've written yesterday, which is also needed for Solaris.
Comment 4 David Faure 2009-11-13 21:53:50 UTC
I don't like platform-specific ifdefs, they don't solve the problem the right way (what if solaris gets DT_DIR later; what about other systems that might be missing DT_DIR, etc). Better have a proper configure check for the missing stuff.

In this case, it turns out that the check already exists: kdecore/kernel/kstandarddirs.cpp uses #ifdef HAVE_DIRENT_D_TYPE, and this seems to work for you, otherwise your compilation would have stopped there first ;)
I'll use it in kio_file.
Comment 5 David Faure 2009-11-13 22:28:36 UTC
SVN commit 1048732 by dfaure:

Fix compilation on systems without d_type/DT_DIR, like Solaris
BUG: 191544


 M  +15 -1     file_unix.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1048732