Bug 125439 - Compile error on Solaris 8 - core/tiles/kis_tilemanager.cc uses madvise without a prototype
Summary: Compile error on Solaris 8 - core/tiles/kis_tilemanager.cc uses madvise witho...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Bart Coppens
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-12 18:06 UTC by Steve Evans
Modified: 2006-05-17 16:43 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Evans 2006-04-12 18:06:03 UTC
Version:           1.5.0 (using KDE KDE 3.5.2)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.3 
OS:                Solaris

I get this compile error:

gmake[1]: Entering directory `/export/home/stevee/kde_build/koffice-1.5.0/krita/core/tiles'
if /bin/bash ../../../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../.. -I./../ -I./../../sdk -I../../../lib/kofficeui -I../../../lib/kofficeui -I../../../lib/kofficecore -I../../../lib/kofficecore -I../../../lib/store -I../../../lib/store -I../../../lib/kwmf -I../../../lib/kwmf -I../../../lib/kopalette -I../../../lib/kopalette -I../../../lib/interfaces -I/opt/kde/include -I/opt/qt/include   -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include  -DQT_THREAD_SUPPORT -I/opt/kde/include -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include -I/opt/qt/include  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4  -Wno-long-long -Wundef -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -I/opt/kde/include -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include -I/opt/qt/include -O2 -fomit-frame-pointer -DNeedVarargsPrototypes=1 -DNeedFunctionPrototypes=1 -pipe -fno-exceptions -mcpu=ultrasparc -Wno-non-virtual-dtor -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -DHAVE_KNEWSTUFF  -MT kis_tilemanager.lo -MD -MP -MF ".deps/kis_tilemanager.Tpo" -c -o kis_tilemanager.lo kis_tilemanager.cc; \
then mv -f ".deps/kis_tilemanager.Tpo" ".deps/kis_tilemanager.Plo"; else rm -f ".deps/kis_tilemanager.Tpo"; exit 1; fi
kis_tilemanager.cc: In member function `void KisTileManager::deregisterTile(KisTile*)':
kis_tilemanager.cc:176: error: `madvise' undeclared (first use this function)
kis_tilemanager.cc:176: error: (Each undeclared identifier is reported only once for each function it appears in.)
kis_tilemanager.cc: In member function `void KisTileManager::fromSwap(KisTileManager::TileInfo*)':
kis_tilemanager.cc:244: error: `madvise' undeclared (first use this function)
kis_tilemanager.cc: In member function `void KisTileManager::toSwap(KisTileManager::TileInfo*)':
kis_tilemanager.cc:344: error: `madvise' undeclared (first use this function)
distcc[10674] ERROR: compile kis_tilemanager.cc on gandalf/3 failed
gmake[1]: *** [kis_tilemanager.lo] Error 1
Comment 1 Halla Rempt 2006-04-12 20:47:16 UTC
What do you suggest to use instead? I've assigned this bug to Bart Coppens, since he knows this code best.
Comment 2 Steve Evans 2006-04-13 10:41:23 UTC
madvise can be used, it is just that there is no prototype for it. See the bug 114747 for a similar problem in another part of KDE. Note however that the final patch is wrong because the statement:

extern "C" extern int madvise(caddr_t, size_t, int);

contains a spurious extra extern after the "C" that should not be there.
Comment 3 Bart Coppens 2006-04-21 15:27:53 UTC
SVN commit 532178 by coppens:

Work on Solaris (I hope, still compiles on AMD64, but I have no access to a Solaris machine that I can use to compile Krita on ;P)
BUG: 125439

 M  +5 -0      kis_tilemanager.cc  


--- branches/koffice/1.5/koffice/krita/core/tiles/kis_tilemanager.cc #532177:532178
@@ -36,6 +36,11 @@
 #include "kis_tile.h"
 #include "kis_tilemanager.h"
 
+// see Bug 125439 - Work on Solaris
+#ifdef Q_OS_SOLARIS
+extern "C" int madvise(caddr_t, size_t, int);
+#endif
+
 // Note: the cache file doesn't get deleted when we crash and so :(
 
 KisTileManager* KisTileManager::m_singleton = 0;
Comment 4 Steve Evans 2006-04-21 16:00:10 UTC
Unfortunatelty it doesn't compile on Solaris 8 with that change applied:

kis_tilemanager.cc: In member function `void KisTileManager::deregisterTile(KisTile*)':
kis_tilemanager.cc:182: error: invalid conversion from `Q_UINT8*' to `char*'
kis_tilemanager.cc:182: error:   initializing argument 1 of `int madvise(char*, size_t, int)'
kis_tilemanager.cc: In member function `void KisTileManager::fromSwap(KisTileManager::TileInfo*)':
kis_tilemanager.cc:250: error: invalid conversion from `Q_UINT8*' to `char*'
kis_tilemanager.cc:250: error:   initializing argument 1 of `int madvise(char*, size_t, int)'
kis_tilemanager.cc: In member function `void KisTileManager::toSwap(KisTileManager::TileInfo*)':
kis_tilemanager.cc:350: error: invalid conversion from `Q_UINT8*' to `char*'
kis_tilemanager.cc:350: error:   initializing argument 1 of `int madvise(char*, size_t, int)'
kis_tilemanager.cc:352: error: invalid conversion from `Q_UINT8*' to `char*'
kis_tilemanager.cc:352: error:   initializing argument 1 of `int madvise(char*, size_t, int)'
kis_tilemanager.cc:363: error: invalid conversion from `Q_UINT8*' to `char*'
kis_tilemanager.cc:363: error:   initializing argument 1 of `int madvise(char*, size_t, int)'
distcc[12048] ERROR: compile kis_tilemanager.cc on gandalf/3 failed

On Solaris the first agument to madvise is of type caddr_t which is a char *. On Linux the type madvise's first argument is void *, so it doesn't show this problem.

I also have access to hpux machines and they also use caddr_t which is defined as char *

I changed the patch to:

+// see Bug 125439 - Work on Solaris
+#ifdef Q_OS_SOLARIS
+extern "C" int madvise(void *, size_t, int);
+#endif
+

and it now compiles.
Comment 5 Bart Coppens 2006-05-04 13:40:41 UTC
SVN commit 537301 by coppens:

Should have done this long ago... Another attempt to fix that Solaris bug, as suggested by stevee.
CCBUG:125439

 M  +1 -1      kis_tilemanager.cc  


--- branches/koffice/1.5/koffice/krita/core/tiles/kis_tilemanager.cc #537300:537301
@@ -38,7 +38,7 @@
 
 // see Bug 125439 - Work on Solaris
 #ifdef Q_OS_SOLARIS
-extern "C" int madvise(caddr_t, size_t, int);
+extern "C" int madvise(void *, size_t, int);
 #endif
 
 // Note: the cache file doesn't get deleted when we crash and so :(
Comment 6 Halla Rempt 2006-05-09 21:41:04 UTC
Did this fix compilation on Solaris? If this can be confirmed, we can close 
the bug :-).
Comment 7 Steve Evans 2006-05-10 10:42:36 UTC
Yes it does fix the compilation, thanks.
Comment 8 Thiago Macieira 2006-05-17 16:43:24 UTC
Reporter confirms it's fixed.