Bug 124469 - Solaris compile error: determining hardware address in findNICs()
Summary: Solaris compile error: determining hardware address in findNICs()
Status: RESOLVED FIXED
Alias: None
Product: kcontrol
Classification: Unmaintained
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Compiled Sources Solaris
: NOR normal
Target Milestone: ---
Assignee: Alexander Neundorf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-29 07:09 UTC by Michael Lambrellis
Modified: 2007-07-09 13:13 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
patch for kdebase-3.5.2/kcontrol/nics/nic.cpp (620 bytes, patch)
2006-03-30 02:55 UTC, Michael Lambrellis
Details
revised solaris patch (817 bytes, patch)
2006-05-19 01:36 UTC, Mark Davies
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Lambrellis 2006-03-29 07:09:49 UTC
Version:           3.5.2 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.4.5 
OS:                Solaris

I encountered the following error compiling kdebase-3.5.2 on Solaris 9 using gcc 3.4.5 (with GNU ld/as):

Making all in nics
make[3]: Entering directory `/apps/devtools/download/kdebase-3.5.2/kcontrol/nics'
/apps/devtools/kit/bin/moc ./nic.h -o nic.moc
if /bin/bash ../../libtool --silent --tag=CXX --mode=compile /apps/devtools/kit/bin/g++ -mcpu=ultrasparc3 -mvis -DHAVE_CONFIG_H -I. -I. -I../..  -I/apps/devtools/kit/include   -I/apps/devtools/build/include -I/apps/devtools/kit/include -I/usr/local/include -I/usr/sfw/include -I/usr/xpg4/include -I/usr/include -I/usr/openwin/include -I/usr/dt/include -DQT_THREAD_SUPPORT -O2 -mcpu=ultrasparc3 -mvis -I/apps/devtools/build/include -I/apps/devtools/kit/include -I/usr/local/include -I/usr/xpg4/include -I/usr/include -I/usr/include/glib-2.0 -I/usr/include/pango-1.0 -I/usr/include/gtk-2.0 -I/usr/sfw/include -I/usr/sfw/include/freetype2 -I/usr/openwin/include -I/usr/dt/include -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4 -D_FILE_OFFSET_BITS=64  -Wno-long-long -Wundef -Wall -W -Wpointer-arith -DNDEBUG -DNO_DEBUG -O2 -O2 -mcpu=ultrasparc3 -mvis -I/apps/devtools/build/include -I/apps/devtools/kit/include -I/usr/local/include -I/usr/xpg4/include -I/usr/include -I/usr/include/glib-2.0 -I/usr/include/pango-1.0 -I/usr/include/gtk-2.0 -I/usr/sfw/include -I/usr/sfw/include/freetype2 -I/usr/openwin/include -I/usr/dt/include -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 -D_GNU_SOURCE  -MT nic.lo -MD -MP -MF ".deps/nic.Tpo" -c -o nic.lo nic.cpp; \
then mv -f ".deps/nic.Tpo" ".deps/nic.Plo"; else rm -f ".deps/nic.Tpo"; exit 1; fi
nic.cpp: In function `NICList* findNICs()':
nic.cpp:218: error: `SIOCGIFHWADDR' was not declared in this scope
nic.cpp:221: error: 'union ifreq::<anonymous>' has no member named 'ifru_hwaddr'
nic.cpp:218: warning: unused variable 'SIOCGIFHWADDR'
make[3]: *** [nic.lo] Error 1
make[3]: Leaving directory `/apps/devtools/download/kdebase-3.5.2/kcontrol/nics'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/apps/devtools/download/kdebase-3.5.2/kcontrol'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/apps/devtools/download/kdebase-3.5.2'
make: *** [all] Error 2


The method used to determine the hardware address on Solaris is different from the one on Linux. I have modified the file kcontrol/nics/nic.cpp to use the Solaris method when appropriate. The following patch seems to work:

*** nic.cpp.orig        Fri Mar 17 21:17:14 2006
--- nic.cpp     Wed Mar 29 15:29:36 2006
***************
*** 215,224 ****
--- 215,232 ----
              tmp->netmask=i18n("Unknown");

           ifcopy=*ifr;
+ #ifdef USE_SOLARIS
+          result=ioctl(sockfd,SIOCGENADDR,&ifcopy);
+ #else
           result=ioctl(sockfd,SIOCGIFHWADDR,&ifcopy);
+ #endif
           if (result==0)
           {
+ #ifdef USE_SOLARIS
+             char *n = &ifcopy.ifr_ifru.ifru_enaddr[0];
+ #else
              char *n = &ifcopy.ifr_ifru.ifru_hwaddr.sa_data[0];
+ #endif
              tmp->HWaddr = HWaddr2String(n);
           }
           else
Comment 1 Bernd Kuhls 2006-03-30 01:03:02 UTC
Same here, Solaris 8/Sparc, gcc-3.4.5.
The patch solved the problem, thanks.
Comment 2 Michael Lambrellis 2006-03-30 02:55:44 UTC
Created attachment 15365 [details]
patch for kdebase-3.5.2/kcontrol/nics/nic.cpp

The patch is valid against kdebase-3.5.2/kcontrol/nics/nic.cpp
Please note the patch does not contain file paths.

Does this mean I get my name in lights? :-)
Comment 3 Jens Hatlak 2006-04-07 16:07:37 UTC
same on Sparc/Solaris 8, gcc 4.0.3. Trying patch now...
Comment 4 Mark Davies 2006-05-19 01:36:54 UTC
Created attachment 16165 [details]
revised solaris patch

Here is an alternate version of the patch that I think is cleaner.  We've been
using this one in pkgsrc.
Comment 5 Jens Hatlak 2006-10-12 14:02:33 UTC
So, this bug is still valid, patch still works. Any reason not to fix it?
Comment 6 Bernd Kuhls 2006-10-17 17:29:06 UTC
Patch still works for KDE-3.5.5, its a pitty that it was not committed;-)
Comment 7 Peter Kruse 2006-10-25 10:46:19 UTC
I can confirm this bug, and also confirm that it works (compiles) with 3.5.5.
I don't get it, this bug is known since 3.5.2, it has 23 votes, several
confirms, there is a patch, that obsiously works, and it sill has a status
UNCONFIRMED?  I mean, without this patch, it doesn't even compile!!!
is there anybody out there...?
Comment 8 Alexander Neundorf 2006-11-11 01:12:03 UTC
Can you please check that the current version works for you ? http://websvn.kde.org/branches/KDE/3.5/kdebase/kcontrol/nics/nic.cpp?rev=603976&view=auto 

Thanks
Alex
Comment 9 Alexander Neundorf 2006-11-11 01:12:48 UTC
Please reopen if it doesn't work for you.

Alex
Comment 10 Alexander Neundorf 2006-11-11 01:26:23 UTC
Can you please check whether this one: http://bugs.kde.org/show_bug.cgi?id=101023 still happens with current nic.cpp and let me know ?

Thanks
Alex
Comment 11 Jens Hatlak 2006-11-12 18:45:09 UTC
I can verify that the change (generated a patch from the link from comment 8) makes kdebase-3.5.5 compile. Since I didn't see bug 101023, I cannot comment on that one. But as far as I am concerned, *this* bug is fixed. Thanks!
Comment 12 Bernd Kuhls 2007-03-29 22:17:50 UTC
I can second that, kdebase-3.5.6 compiled without problems
Comment 13 Michael Lindig 2007-07-09 11:04:45 UTC
I can third that, kdebase-3.5.7 compiled without problems :) !
Comment 14 John Talbot 2007-07-09 13:13:51 UTC
I'll fourth that compiling on Solaris 2.8 for both kdebase-3.5.6 and kdebase-3.5.7