Summary: | Compile error in ksycoca.cpp on Solaris 9 (temp. solution incl.) | ||
---|---|---|---|
Product: | [Unmaintained] kdelibs | Reporter: | Bernd Kuhls <bernd.kuhls> |
Component: | ksycoca | Assignee: | Dirk Mueller <mueller> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jh, stevee |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Solaris | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Bernd Kuhls
2005-10-20 09:35:06 UTC
I have a similar problem on Solaris 8. However for me the fix of removing <sys/mman.h> does *not* work. Examining <sys/mman.h> shows that it does contain a prototype for madvise, but if this statement: #if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) is true then the prototype is not available. Neither of these #defines is explictly set, either on the command line or in config.h, so I am guessing that the compiler sets them. Not solved in kdelibs-479465 snapshot Still not solved in kdelibs-480871 snapshot Not fixed in KDE-3.5.0 release version. whoops. SVN commit 484188 by mueller: conditionalize madvise() for less linux-compatible systems CCBUG:114747 M +1 -1 configure.in.in M +2 -1 ksycoca.cpp --- branches/KDE/3.5/kdelibs/kdecore/configure.in.in #484187:484188 @@ -83,7 +83,7 @@ KDE_CHECK_HEADERS([netinet/in.h net/if.h],,,[$netincludes]) KDE_CHECK_HEADERS([sys/filio.h]) -AC_CHECK_FUNCS([usleep poll]) +AC_CHECK_FUNCS([usleep poll madvise]) dnl Check for struct addrinfo AC_CHECK_TYPES([struct addrinfo],,,[$netincludes]) --- branches/KDE/3.5/kdelibs/kdecore/ksycoca.cpp #484187:484188 @@ -144,8 +144,9 @@ } else { +#ifdef HAVE_MADVISE (void) madvise((void*)m_sycoca_mmap, m_sycoca_size, MADV_WILLNEED); - +#endif QByteArray b_array; b_array.setRawData(m_sycoca_mmap, m_sycoca_size); QBuffer *buffer = new QBuffer( b_array ); SVN commit 484189 by mueller: conditionalize madvise() for less-linux-compatible systems BUG: 114747 M +1 -1 configure.in.in M +2 -0 ksycoca.cpp --- trunk/KDE/kdelibs/kdecore/configure.in.in #484188:484189 @@ -83,7 +83,7 @@ KDE_CHECK_HEADERS([netinet/in.h net/if.h],,,[$netincludes]) KDE_CHECK_HEADERS([sys/filio.h]) -AC_CHECK_FUNCS([usleep poll]) +AC_CHECK_FUNCS([usleep poll madvise]) dnl Check for struct addrinfo AC_CHECK_TYPES([struct addrinfo],,,[$netincludes]) --- trunk/KDE/kdelibs/kdecore/ksycoca.cpp #484188:484189 @@ -141,7 +141,9 @@ } else { +#ifdef HAVE_MADVISE (void) madvise((void*)m_sycoca_mmap, m_sycoca_size, MADV_WILLNEED); +#endif QByteArray b = QByteArray::fromRawData(m_sycoca_mmap, m_sycoca_size); QBuffer *buffer = new QBuffer( new QByteArray(b) ); buffer->open(QIODevice::ReadOnly); I'm still seeing this on Sparc/Solaris 8, KDE 3.5, gcc 4.0.2, patches applied, configure rebuilt. The problem seems to be that the madvise test in configure passes even though the function is not available in the form used in ksycoca.cpp. The error is: ksycoca.cpp: In member function 'bool KSycoca::openDatabase(bool)': ksycoca.cpp:148: error: 'madvise' was not declared in this scope The relevant lines from config.log: configure:43591: checking for madvise configure:43648: gcc -o conftest -O2 -DQT_THREAD_SUPPORT -I/usr/local/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -L/usr/local/lib/qt-3.3/lib-g++3 -R/usr/local/lib/qt-3.3/lib-g++3 -L/usr/local/lib -R/usr/local/lib conftest.c >&5 configure:43654: $? = 0 configure:43658: test -z || test ! -s conftest.err configure:43661: $? = 0 configure:43664: test -s conftest configure:43667: $? = 0 configure:43679: result: yes Some lines from /usr/include/sys/mman.h: #ifdef __STDC__ #if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) extern void *mmap(void *, size_t, int, int, int, off_t); extern int munmap(void *, size_t); extern int mprotect(void *, size_t, int); extern int msync(void *, size_t, int); #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) extern int mlock(const void *, size_t); extern int munlock(const void *, size_t); extern int shm_open(const char *, int, mode_t); extern int shm_unlink(const char *); #endif /* (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2))... */ /* transitional large file interface version */ #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ !defined(__PRAGMA_REDEFINE_EXTNAME)) extern void *mmap64(void *, size_t, int, int, int, off64_t); #endif /* _LARGEFILE64_SOURCE... */ #else /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */ extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t); extern int munmap(caddr_t, size_t); extern int mprotect(caddr_t, size_t, int); extern int msync(caddr_t, size_t, int); extern int mlock(caddr_t, size_t); extern int munlock(caddr_t, size_t); extern int mincore(caddr_t, size_t, char *); extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); extern int madvise(caddr_t, size_t, int); /* transitional large file interface version */ #ifdef _LARGEFILE64_SOURCE extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t); #endif #endif /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */ #if (!defined(_XPG4_2) || (_POSIX_C_SOURCE > 2)) || defined(__EXTENSIONS__) extern int mlockall(int); extern int munlockall(void); #endif /* mmap failure value */ #define MAP_FAILED ((void *) -1) #else /* __STDC__ */ extern caddr_t mmap(); extern int munmap(); extern int mprotect(); extern int mincore(); extern int memcntl(); extern int msync(); extern int madvise(); extern int mlock(); extern int mlockall(); extern int munlock(); extern int munlockall(); /* transitional large file interface version */ #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ !defined(__PRAGMA_REDEFINE_EXTNAME)) extern caddr_t mmap64(); #endif /* _LARGEFILE64_SOURCE... */ #endif /* __STDC__ */ ok, can you try if adding extern int madvise(); at the beginning of the file fixes it? No: ksycoca.cpp: In member function 'bool KSycoca::openDatabase(bool)': ksycoca.cpp:49: error: too many arguments to function 'int madvise()' ksycoca.cpp:150: error: at this point in file SVN commit 502221 by mueller: solaris sucks, as usual CCBUG:114747 M +6 -1 ksycoca.cpp [POSSIBLY UNSAFE: system] --- branches/KDE/3.5/kdelibs/kdecore/ksycoca.cpp #502220:502221 @@ -42,6 +42,10 @@ #include <sys/mman.h> #endif +#ifdef Q_OS_SOLARIS +extern int madvise(caddr_t, size_t, int); +#endif + #ifndef MAP_FAILED #define MAP_FAILED ((void *) -1) #endif @@ -439,7 +443,8 @@ return; _self->d->readError = true; if (_self->d->autoRebuild) - system("kbuildsycoca"); // Rebuild the damned thing. + if(system("kbuildsycoca") < 0) // Rebuild the damned thing. + qWarning("ERROR: Running KSycoca failed."); } } SVN commit 502222 by mueller: solaris sucks, as usal. BUG:114747 M +6 -1 ksycoca.cpp [POSSIBLY UNSAFE: system] --- trunk/KDE/kdelibs/kdecore/ksycoca.cpp #502221:502222 @@ -40,6 +40,10 @@ #include <sys/mman.h> #endif +#ifdef Q_OS_SOLARIS +extern int madvise(caddr_t, size_t, int); +#endif + #ifndef MAP_FAILED #define MAP_FAILED ((void *) -1) #endif @@ -443,7 +447,8 @@ return; _self->d->readError = true; if (_self->d->autoRebuild) - system("kbuildsycoca"); // Rebuild the damned thing. + if(system("kbuildsycoca") < 0) // Rebuild the damned thing. + qWarning("ERROR: Running KSycoca failed."); } } Still not fixed, sorry: ksycoca.cpp: In member function 'bool KSycoca::openDatabase(bool)': ksycoca.cpp:152: error: invalid conversion from 'void*' to 'char*' ksycoca.cpp:152: error: initializing argument 1 of 'int madvise(char*, size_t, int)' In /usr/include/sys/types.h, caddr_t is defined as char: typedef char *caddr_t; /* ?<core address> type */ I committed a workaround.. OK, but now I get: Undefined first referenced symbol in file madvise(char*, unsigned int, int) ./.libs/libkdecore.so ld: fatal: Symbol referencing errors. No output written to .libs/kde-config collect2: ld returned 1 exit status ok, and this patch? --- ksycoca.cpp (revision 502540) +++ ksycoca.cpp (working copy) @@ -43,7 +43,7 @@ #endif #ifdef Q_OS_SOLARIS -extern int madvise(caddr_t, size_t, int); +extern "C" extern int madvise(caddr_t, size_t, int); #endif #ifndef MAP_FAILED Great, that did it! TUVM ok, closing as fixed. this bug is not fixed, see bug #124416 please compile between releases. As long as we have no active SVN users using solaris, the situation won't get better ;( You can also commit right into SVN, if you apply for an account |