Bug 124416

Summary: kdelibs 3.5.2 - Compile error on Solaris 8: duplicate extern
Product: [Unmaintained] kdelibs Reporter: Steve Evans <stevee>
Component: generalAssignee: Stephan Kulow <coolo>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Steve Evans 2006-03-28 13:07:46 UTC
Version:           kde 3.5.2 (using KDE KDE 3.5.1)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.3 
OS:                Solaris

I get this compile error when building kdelibs-3.5.2 on Solaris 8:

if /bin/bash ../libtool --silent --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../dcop -I. -I../kio/kssl -I../kjs -I../kdefx -I../kdecore/network -I../dcop -I../libltdl -I../kdefx -I../kdecore -I../kdecore -I../kdeui -I../kio -I../kio/kio -I../kio/kfile -I.. -I/opt/qt/include  -I/opt/kde/include -I/gorbag/exta/cad/externals/SOLARIS/gnome2/include/glib-2.0 -I/gorbag/exta/cad/externals/SOLARIS/include -I/gorbag/exta/cad/externals/SOLARIS/include/libart-2.0  -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  -MT ksycoca.lo -MD -MP -MF ".deps/ksycoca.Tpo" -c -o ksycoca.lo ksycoca.cpp; \
then mv -f ".deps/ksycoca.Tpo" ".deps/ksycoca.Plo"; else rm -f ".deps/ksycoca.Tpo"; exit 1; fi
ksycoca.cpp:46: error: duplicate `extern'

Which appears to be caused by this code:

#ifdef Q_OS_SOLARIS
extern "C" extern int madvise(caddr_t, size_t, int); 
#endif

Changing it to:
#ifdef Q_OS_SOLARIS
extern "C" int madvise(caddr_t, size_t, int); 
#endif

allows it to compile
Comment 1 Bernd Kuhls 2006-03-28 23:30:25 UTC
Same here, using the same patch works for me as well.
This is a rest from https://bugs.kde.org/show_bug.cgi?id=114747
Comment 2 Michael Lambrellis 2006-03-29 03:44:56 UTC
I can confirm this.

Compiling KDE 3.5.2 on Solaris 9 using gcc 3.4.5 gives:
 In file included from libkdecore_la.all_cpp.cpp:72:
 ksycoca.cpp: At global scope:
 ksycoca.cpp:46: error: duplicate `extern'

Stephan's change fixes this.

NOTE: The wrong code also exists in the current trunk not just the 3.5 branch.

*** kdelibs-3.5.2/kdecore/ksycoca.cpp   Fri Mar 17 21:19:04 2006
--- kdelibs/kdecore/ksycoca.cpp Wed Mar 29 11:22:59 2006
***************
*** 43,49 ****
  #endif

  #ifdef Q_OS_SOLARIS
! extern "C" extern int madvise(caddr_t, size_t, int);
  #endif

  #ifndef MAP_FAILED
--- 43,49 ----
  #endif

  #ifdef Q_OS_SOLARIS
! extern "C" int madvise(caddr_t, size_t, int);
  #endif

  #ifndef MAP_FAILED
Comment 3 Bernd Kuhls 2006-06-01 19:25:02 UTC
Still not fixed in kdelibs-3.5.3
Comment 4 groot 2006-06-12 10:51:55 UTC
SVN commit 550555 by adridg:

Resolve duplicate externs. Bernd (someone with Solaris) please test.

BUG: 124416
BUG: 114747
CCMAIL: bernd.kuhls@informatik.uni-oldenburg.de


 M  +4 -1      ksycoca.cpp  


--- branches/KDE/3.5/kdelibs/kdecore/ksycoca.cpp #550554:550555
@@ -43,7 +43,10 @@
 #endif
 
 #ifdef Q_OS_SOLARIS
-extern "C" extern int madvise(caddr_t, size_t, int); 
+extern "C" 
+{
+	extern int madvise(caddr_t, size_t, int); 
+}
 #endif
 
 #ifndef MAP_FAILED
Comment 5 Steve Evans 2006-06-12 11:14:59 UTC
That change fixes the compile problem for me. On Solaris 8, gcc 3.4.6