Bug 99336 - kdebase-3.3.92/kcontrol/kfontinst/kfontinst/GetPid.c doesn't compile on Solaris 2.6 - incorrect kfi_getPid prototype
Summary: kdebase-3.3.92/kcontrol/kfontinst/kfontinst/GetPid.c doesn't compile on Solar...
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Miscellaneous
Component: kcmfontinst (show other bugs)
Version: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Craig Drummond
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-14 10:53 UTC by Steve Evans
Modified: 2005-03-02 14:21 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Evans 2005-02-14 10:53:43 UTC
Version:            (using KDE KDE 3.3.92)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.3 
OS:                Solaris

I get this compile error on Solaris:

if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -DOS_Solaris -I./../lib -I./../../fonts -I/opt/kde/include -I/opt/qt/include   -I/gorbag/exta/cad/externals/SOLARIS/include -I/gorbag/exta/cad/externals/SOLARIS/include -I/gorbag/exta/cad/externals/SOLARIS/include/freetype2 -I/gorbag/exta/cad/externals/SOLARIS/include   -DQT_THREAD_SUPPORT -I/opt/kde/include -I/gorbag/exta/cad/externals/SOLARIS/include -I/opt/qt/include  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -D_FILE_OFFSET_BITS=32 -D_LARGE_FILES=1  -DNDEBUG -O2  -I/opt/kde/include -I/gorbag/exta/cad/externals/SOLARIS/include -I/opt/qt/include  -O2 -fomit-frame-pointer  -DNeedVarargsPrototypes=1 -DNeedFunctionPrototypes=1 -pipe -fno-exceptions -mcpu=ultrasparc -D_GNU_SOURCE -MT GetPid.o -MD -MP -MF ".deps/GetPid.Tpo" -c -o GetPid.o GetPid.c; \
then mv -f ".deps/GetPid.Tpo" ".deps/GetPid.Po"; else rm -f ".deps/GetPid.Tpo"; exit 1; fi
GetPid.c:256: error: conflicting types for 'kfi_getPid'
GetPid.c:85: error: previous declaration of 'kfi_getPid' was here
GetPid.c:256: error: conflicting types for 'kfi_getPid'
GetPid.c:85: error: previous declaration of 'kfi_getPid' was here


This happens because there is a prototype for kfi_getPid:

unsigned int kfi_getPid(const char *proc, unsigned int ppid);

which is followed by different implementations for different platforms. The Solaris version is defined as:

unsigned int kfi_getPid(const char *proc, pid_t ppid)
{

which doesn't match the prototype.
Comment 1 Craig Drummond 2005-02-15 23:47:48 UTC
>
> which doesn't match the prototype.

Does it work if you remove the prototype?

Craig.

Comment 2 Steve Evans 2005-02-16 10:50:31 UTC
Yes, but a better solution is to provide a platform specific prototype, like this:

#if defined OS_Irix || defined OS_Solaris
unsigned int kfi_getPid(const char *proc, pid_t ppid);
#else
unsigned int kfi_getPid(const char *proc, unsigned int ppid);
#endif
Comment 3 Craig Drummond 2005-02-16 11:50:09 UTC
OK. Well the prototype in GetPid.c is not required - not sure why I put it there... But there's an "extern kfi_getPid(...)" in XConfig.cpp that should use the platform specific prototype you mentioned above. I will make this change as soon as I can. Thanks for spotting this, and the other bug - which I'll look into later.
Comment 4 Craig Drummond 2005-02-22 16:14:54 UTC
Can you confirm that the latest GetPid.c and XConfig.cpp in CVS...

http://webcvs.kde.org/*checkout*/kdebase/kcontrol/kfontinst/kfontinst/GetPid.c?rev=1.2
http://webcvs.kde.org/*checkout*/kdebase/kcontrol/kfontinst/kfontinst/XConfig.cpp?rev=1.23

...fix the problem? If so I'll close the bug report.
Comment 5 Steve Evans 2005-02-22 17:46:59 UTC
Yes, those files fix the problem. Thanks.
Comment 6 Craig Drummond 2005-02-23 00:11:10 UTC
*** Bug has been marked as fixed ***.
Comment 7 Bernd Kuhls 2005-02-23 15:36:50 UTC
Using snapshot 050222 which includes both files still fails to compile here:

uname -a
SunOS sunray 5.9 Generic_117171-14 sun4u sparc SUNW,Sun-Fire-880 Solaris

if gcc -DHAVE_CONFIG_H -I. -I. -I../../..  -DOS_Solaris -I./../lib -I./../../fonts -I/usr/local/KDE-3.4.0_CVS/include -I/usr/local/qt-050201/include   -I/usr/local2/lude/soft/freetype-2.1.9/run/default/sparc_sun_solaris2.9/include/freetype2 -I/usr/local2/lude/soft/freetype-2.1.9/run/default/sparc_sun_solaris2.9/include -I/usr/local2/lude/soft/fontconfig-2.2.2/run/default/sparc_sun_solaris2.9/include   -DQT_THREAD_SUPPORT  -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -D_FILE_OFFSET_BITS=64  -DNDEBUG -O2   -D_GNU_SOURCE -MT GetPid.o -MD -MP -MF ".deps/GetPid.Tpo"\
  -c -o GetPid.o `test -f 'GetPid.c' || echo './'`GetPid.c; \
then mv -f ".deps/GetPid.Tpo" ".deps/GetPid.Po"; \
else rm -f ".deps/GetPid.Tpo"; exit 1; \
fi
In file included from /usr/include/procfs.h:26,
                 from GetPid.c:246:
/usr/include/sys/procfs.h:44:2: #error "Cannot use procfs in the large file compilation environment"
make[4]: *** [GetPid.o] Error 1

Using this patch on top of your files works, the patch is described here:
http://article.gmane.org/gmane.comp.kde.solaris/2089

--- ./kdebase/kcontrol/kfontinst/kfontinst/GetPid.c     2004-11-12 23:42:24.000000000 +0100
+++ ./kdebase/kcontrol/kfontinst/kfontinst/GetPid.c     2005-02-16 13:47:53.894184000 +0100
@@ -245,7 +249,19 @@
 #include <pwd.h>
 #include <sys/resource.h>
 #ifdef OS_Solaris
+#if (!defined(_LP64)) && (_FILE_OFFSET_BITS - 0 == 64)
+#define PROCFS_FILE_OFFSET_BITS_HACK 1
+#undef _FILE_OFFSET_BITS
+#else
+#define PROCFS_FILE_OFFSET_BITS_HACK 0
+#endif
+
 #include <procfs.h>
+
+#if (PROCFS_FILE_OFFSET_BITS_HACK - 0 == 1)
+#define _FILE_OFFSET_BITS 64
+#endif
+
 #else
 #include <sys/procfs.h>
 #include <sys/sysmp.h>

Comment 8 Steve Evans 2005-02-23 15:52:03 UTC
Ah yes, I get that on solaris 2.6 as well. I had forgotten about it because I worked around it by changing -D_FILE_OFFSET_BITS=64 in the Makefile to 32. I then forgot to report a bug about it :-(
Comment 9 Craig Drummond 2005-02-23 16:41:04 UTC
Hi,

Thanks for this - I've applied the patch. Can you get Version 1.3 of GetPid.c, 
and check that everything is OK now.

Once again, thanks for your help.

Craig.

Comment 10 Bernd Kuhls 2005-02-23 17:52:39 UTC
File isn't in webCVS atm, will try tomorrow.
http://webcvs.kde.org//kdebase/kcontrol/kfontinst/kfontinst/GetPid.c
Comment 11 Bernd Kuhls 2005-02-27 22:46:49 UTC
Unfortunately version 1.3 did not make it into 3.4.0rc1
Comment 12 Bernd Kuhls 2005-03-02 14:21:38 UTC
Ok, correct file is in snapshot 050302 now, thanks!