Bug 75397

Summary: KDENetwork-3.2 does not compile because: "/usr/include/iwlib.h:339: error: too few arguments to function"
Product: [Unmaintained] kwireless Reporter: jaime
Component: generalAssignee: Stefan Winter <swinter>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description jaime 2004-02-16 22:19:20 UTC
Version:            (using KDE KDE 3.2.0)
Installed from:    Compiled From Sources
Compiler:          Thread model: posix
gcc version 3.3.2 (Debian) 
OS:          Linux

First of all sorry for opening a bug in Kate. I did not found KDENetwork nor kwireless to open the bug to, so i chose a live application just to "relocate" my bug...

I cannot compile kdenetwork, the report i get is:
======================================================
/usr/share/qt3/bin/moc ../../../wifi/kwireless/linuxwirelesswidget.h -o linuxwirelesswidget.moc
if /bin/sh ../../libtool --silent --mode=compile --tag=CXX g++ -DHAVE_CONFIG_H -I. -I../../../wifi/kwireless -I../.. -I/usr/include/kde -I/usr/include/qt3 -I/usr/X11R6/include   -DQT_THREAD_SUPPORT  -D_REENTRANT -D_FILE_OFFSET_BITS=64  -Wnon-virtual-dtor -Wno-long-long -Wundef -Wall -W -Wpointer-arith -Wwrite-strings -ansi -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -DNDEBUG -DNO_DEBUG -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION  -MT linuxwirelesswidget.lo -MD -MP -MF ".deps/linuxwirelesswidget.Tpo" \
  -c -o linuxwirelesswidget.lo `test -f '../../../wifi/kwireless/linuxwirelesswidget.cpp' || echo '../../../wifi/kwireless/'`../../../wifi/kwireless/linuxwirelesswidget.cpp; \
then mv -f ".deps/linuxwirelesswidget.Tpo" ".deps/linuxwirelesswidget.Plo"; \
else rm -f ".deps/linuxwirelesswidget.Tpo"; exit 1; \
fi
/usr/include/iwlib.h: In member function `virtual void
   LinuxWireLessWidget::poll()':
/usr/include/iwlib.h:339: error: too few arguments to function `int
   iw_get_stats(int, char*, iwstats*, iwrange*, int)'
../../../wifi/kwireless/linuxwirelesswidget.cpp:127: error: at this point in
   file
make[4]: *** [linuxwirelesswidget.lo] Error 1
make[4]: Leaving directory `/kde/kdenetwork-3.2.0/obj-powerpc-linux/wifi/kwireless'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/kde/kdenetwork-3.2.0/obj-powerpc-linux/wifi'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/kde/kdenetwork-3.2.0/obj-powerpc-linux'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/kde/kdenetwork-3.2.0/obj-powerpc-linux'
make: *** [build-stamp] Error 2
=========================0

That is whati get when i try to compile kdenetwork-3.2 in the Debian packaging process.
I am using:
dpkg -l|grep libiw
ii  libiw-dev      26+27pre9-2    Wireless tools - development files
ii  libiw27        26+27pre9-2    Wireless tools - library


Thank you very much.
Comment 1 Dominique Devriese 2004-02-27 22:35:09 UTC
Forgot to cc the bug report on this...

cheers
domi

Hi,

Can anyone please review the following kdenetwork patch ?  It fixes
kdenetwork/wifi compilation with iwlib27 ( which broke backwards
compatibility ).  Note that I have no idea what the iw_range parameter
is, but from the code in the wireless-tools iwlib.c source, I am sure
that it is never used unless has_range is set to non-zero.  As said in
the comment above my modification, someone who knows more about this
code should look into the new interface.

As usual, this patch compiles for me, unless anyone objects, I am
going to commit this to 3_2_BRANCH and HEAD.

cheers
domi

Index: wifi/wirelesstools.cpp
===================================================================
RCS file: /home/kde/kdenetwork/wifi/Attic/wirelesstools.cpp,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 wirelesstools.cpp
--- wifi/wirelesstools.cpp	14 Feb 2004 10:34:10 -0000	1.1.2.1
+++ wifi/wirelesstools.cpp	27 Feb 2004 21:00:36 -0000
@@ -11,6 +11,21 @@
 #include "stuff.h"
 #include "wirelesstools.h"
 
+// domi:the wireless-tools people managed to change their interfaces
+// around.  Someone with more knowledge of this code should look into
+// moving to use the new iw_range interfaces.
+#if WT_VERSION >= 27
+inline int wtc_private_iw_get_stats( int skfd, char* ifname, iwstats* stats )
+{
+  return iw_get_stats( skfd, ifname, stats, 0, 0 );
+}
+#else
+inline int wtc_private_iw_get_stats( int skfd, char* ifname, iwstats* stats )
+{
+  return iw_get_stats( skfd, ifname, stats, 0, 0 );
+}
+#endif
+
 /* ================================== FROM IWCONFIG.C ================================== */
 int get_info(int skfd, char * ifname, struct wireless_info * info)
 {
@@ -154,7 +169,7 @@
 #endif	/* WIRELESS_EXT > 10 */
 
   /* Get stats */
-  if(iw_get_stats(skfd, ifname, &(info->stats)) >= 0)
+  if(wtc_private_iw_get_stats(skfd, ifname, &(info->stats)) >= 0)
     {
       info->has_stats = 1;
     }
@@ -198,7 +213,7 @@
 	    {
 	      char device[128];
 	      snprintf(device,128,"%s",(*it).latin1());
-	      iw_get_stats (transfer->skfd, device, tempic2);
+	      wtc_private_iw_get_stats (transfer->skfd, device, tempic2);
 	      kdDebug() << "Found!\n";
         already_warned=false;
 	      transfer->has_freq = tempic1->has_freq;
@@ -258,7 +273,7 @@
 	{
 	  char device[128];
 	  snprintf(device,128,"%s",transfer->used_interface.latin1());
-	  iw_get_stats (transfer->skfd, device, tempic2);
+	  wtc_private_iw_get_stats (transfer->skfd, device, tempic2);
 	  transfer->has_freq = tempic1->has_freq;
 	  transfer->freq = tempic1->freq;
 	  transfer->mode = tempic1->mode;
Comment 2 Stefan Winter 2004-03-20 10:11:52 UTC
Hi,

the error occurs because of wireless-tools 27 API changes. You can either downgrade to wireless-tools 26 or use KDE 3.2.1, where the new API is used if wireless-tools 27 is found.