Bug 19124 - kdelibs kdesu compile problem redhat 5.2
Summary: kdelibs kdesu compile problem redhat 5.2
Status: CLOSED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Other
: NOR normal
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-01-26 05:03 UTC by Ross Campbell
Modified: 2002-09-16 14: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 Ross Campbell 2001-01-26 04:55:45 UTC
(*** This bug was imported into bugs.kde.org ***)

Package: kdelibs
Version: 2.1 Beta 2
Severity: normal
Installed from: sources

WHen building kdelibs on my redhat-5.2 box with linux-2.4.0 kernel and latest GNU tools I get the following error in the compile of kdesu:

root@vmware[1567]% pwd
/tmp/kdelibs-2.1-beta2/kdesu 
root@vmware[1568]% gmake
/bin/sh ../libtool --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../kio/ -I../dcop -I../libltdl -I../kdecore -I../kdeui -I../kssl -I/usr/local/qt/include -I/usr/X11R6/include -I/usr/local/kde/include   -D_REENTRANT  -O2 -fno-exceptions -fno-check-new -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -Wnon-virtual-dtor -fno-builtin -fpermissive -frtti -DQT_CLEAN_NAMESPACE -DQT_NO_COMPAT -DQT_NO_ASCII_CAST  -c client.cpp
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../kio/ -I../dcop -I../libltdl -I../kdecore -I../kdeui -I../kssl -I/usr/local/qt/include -I/usr/X11R6/include -I/usr/local/kde/include -D_REENTRANT -O2 -fno-exceptions -fno-check-new -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -Wnon-virtual-dtor -fno-builtin -fpermissive -frtti -DQT_CLEAN_NAMESPACE -DQT_NO_COMPAT -DQT_NO_ASCII_CAST -c client.cpp  -fPIC -DPIC -o .libs/client.o
In file included from /usr/include/sys/socket.h:34
                 from client.cpp:24:
/usr/include/socketbits.h:173: warning: ANSI C++ forbids zero-size array `__cmsg_data'
client.cpp: In method `int KDEsuClient::connect()':
client.cpp:118: aggregate `struct ucred cred' has incomplete type and cannot be initialized
client.cpp:122: confused by earlier errors bailing out
gmake: *** [client.lo] Error 1
root@vmware[1569]% pwd
/tmp/kdelibs-2.1-beta2/kdesu 


(submitted via bugs.kde.org)
Comment 1 Stephan Kulow 2001-01-26 10:52:14 UTC
rcampbel3@yahoo.com wrote:
> 
> Package: kdelibs
> Version: 2.1 Beta 2
> Severity: normal
> Installed from: sources
> 
> WHen building kdelibs on my redhat-5.2 box with linux-2.4.0 kernel and latest GNU tools I get the following error in the compile of kdesu:
> 
> root@vmware[1567]% pwd
> /tmp/kdelibs-2.1-beta2/kdesu
> root@vmware[1568]% gmake
> /bin/sh ../libtool --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../kio/ -I../dcop -I../libltdl -I../kdecore -I../kdeui -I../kssl -I/usr/local/qt/include -I/usr/X11R6/include -I/usr/local/kde/include   -D_REENTRANT  -O2 -fno-exceptions -fno-check-new -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -Wnon-virtual-dtor -fno-builtin -fpermissive -frtti -DQT_CLEAN_NAMESPACE -DQT_NO_COMPAT -DQT_NO_ASCII_CAST  -c client.cpp
> g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../kio/ -I../dcop -I../libltdl -I../kdecore -I../kdeui -I../kssl -I/usr/local/qt/include -I/usr/X11R6/include -I/usr/local/kde/include -D_REENTRANT -O2 -fno-exceptions -fno-check-new -Wall -pedantic -W -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long -Wnon-virtual-dtor -fno-builtin -fpermissive -frtti -DQT_CLEAN_NAMESPACE -DQT_NO_COMPAT -DQT_NO_ASCII_CAST -c client.cpp  -fPIC -DPIC -o .libs/client.o
> In file included from /usr/include/sys/socket.h:34
>                  from client.cpp:24:
> /usr/include/socketbits.h:173: warning: ANSI C++ forbids zero-size array `__cmsg_data'
> client.cpp: In method `int KDEsuClient::connect()':
> client.cpp:118: aggregate `struct ucred cred' has incomplete type and cannot be initialized
> client.cpp:122: confused by earlier errors bailing out
> gmake: *** [client.lo] Error 1
> root@vmware[1569]% pwd
> /tmp/kdelibs-2.1-beta2/kdesu
> 
Hi!

I never heard this before.  Can you play a bit with the code to find a solution? Maybe
you have to enable the less secure way because your glibc is too old I don't know

Greetings Stephan

-- 
It's my true belief that people having wishes for the bug report tool
and report it to the author haven't got the idea behind open source.
                                             anonymous KDE developer
Comment 2 Thiago Macieira 2001-01-29 23:40:12 UTC
Stephan Kulow wrote:
>
> Hi!
>
> The above is a compilation problem with kdesu on RH 5.2
> Does someone have an idea about ancient systems? :)

Hi!

I have done a superficial check on glibc's header files and in
kdelibs/kdesu/client.cpp. The compilation problem is caused by the
fact that structure "struct ucred" wasn't ever defined. Please ignore
the "cmsg_data" warning. That's glibc's fault not KDE's.

The code in kdelibs/kdesu/client.cpp using ucred is wrapped around an
#ifdef for SO_PEERCRED (Peer credentials I take it). Unfortunately
even though glibc 2.1.3 I have defines "struct ucred" in
bits/socket.h it is never mentioned in the documentation so I don't
know how standard it is.

Anyways the problem is because bits/socket.h includes asm/socket.h
(in Linux at least) which defines SO_PEERCRED but not struct ucred
which is defined in linux/socket.h. So since changing glibc is out of
the question for KDE :-> here's the solution I propose (sorry no
patch and no test now):

- in the configure script add a check for "struct ucred" in
sys/socket.h which is where we expect that to be. It's just a simple
AC_TRY_COMPILE and AC_DEFINE(HAVE_STRUCT_UCRED)
- in kdelibs/kdesu/client.cpp change the #ifndef SO_PEERCRED to:
#if !defined(SO_PEERCRED) || !defined(HAVE_STRUCT_UCRED)

==== for kdelibs/configure.in.in:
AC_SUBST(HAVE_STRUCT_UCRED)
AC_MSG_CHECKING([for struct ucred])
AC_TRY_COMPILE(
  [
    #include <sys/socket.h>
    struct ucred cred;
  ]
  [ ]
  [
    AC_DEFINE(HAVE_STRUCT_UCRED1[Define if struct ucred is present
from sys/socket.h])
    AC_MSG_RESULT(yes)
  ]
  AC_MSG_RESULT(no)
)
====
--
  Thiago Macieira - UFOT Registry number: 1001
 thiagom@mail.com talha@geocities.com
   ICQ UIN: 1967141  PGP: 0x8F2978D5 and 0xEA9037A5
     Registered Linux user #65028

102/380. You have achieved in disgrace what I always wanted to be. --
Lt. Cmdr. Data "Deja Q"
Comment 3 Stephan Kulow 2001-01-30 10:26:07 UTC
hi!

I added now the check for struct ucred and it works for my
system so it should fix the problem 

Greetings Stephan

-- 
It's my true belief that people having wishes for the bug report tool
and report it to the author haven't got the idea behind open source.
                                             anonymous KDE developer