Red Hat Bugzilla – Bug 111209
/usr/include/net-snmp/utilities.h defines getopt() incorrectly
Last modified: 2015-03-04 20:13:10 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Description of problem:
When compiling wap11gui (http://wap11gui.sourceforge.net), I run into
the following error:
g++ -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/lib/qt-3.1/include
-I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT
-Wno-long-long -Wbad-function-cast -Wundef -Wall -pedantic -W
-Wpointer-arith -Wmissing-prototypes -Wwrite-strings -ansi
-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wcast-align -Wconversion -O2
-fno-exceptions -fno-check-new -fexceptions -DNET_SNMP=1 -c -o
macauthimp.o `test -f macauthimp.cpp || echo './'`macauthimp.cpp
cc1plus: warning: "-Wbad-function-cast" is valid for C/ObjC but not
In file included from /usr/include/net-snmp/utilities.h:26,
~ from /usr/include/net-snmp/net-snmp-includes.h:64,
~ from wap11config.h:24,
~ from macauthimp.h:21,
~ from macauthimp.cpp:22:
/usr/include/net-snmp/library/getopt.h:8: error: declaration of `int
~ getopt(int, char* const*, const char*)' throws different exceptions
/usr/include/getopt.h:154: error: than previous declaration `int
~ char* const*, const char*) throw ()'
make: *** [macauthimp.o] Error 1
make: Leaving directory `/home/ori/projects/wap11gui/wap11gui'
make: *** [all-recursive] Error 1
The problem is that /usr/include/net-snmp/utilities.h defines getopt()
as an extern, instead of including <getopt.h>, as it probably should.
The proper getopt.h is included by unistd.h, which, in a QT app, is
included somewhere inside the bowels of QT. This means that every QT
app that tries to use net-snmp under Fedora won't compile. I can't
think of any way an application could work around this.
This appears to be a new problem - RH 9 and 8.0 didn't have this, and
I haven't seen this problem on any other platform I tried compiling on
(Mandrake, SuSe, FreeBSD and Mac OS X).
Version-Release number of selected component (if applicable):
Correction: /usr/include/net-snmp/utilites.h doesn't declare getopt()
as an extern. Instead, it includes a net-snmp private getopt.h header,
which in turn has the extern declaration.
On my system, patching utilites.h to include the proper <getopt.h>
instead of the private version solves my problem, and doesn't seem to
have any other effects, but I haven't done a lot of testing. Is there
a way to submit a patch for this? (pending more testing)
I reported this to the net-snmp team. This is the bug report, and the
Their fix was to apply the following patch:
diff -u -r5.5 utilities.h
--- include/net-snmp/utilities.h 17 Aug 2003 22:09:21
+++ include/net-snmp/utilities.h 8 Dec 2003 22:07:28
@@ -27,7 +27,11 @@
#include <netinet/in.h> /* for in_addr_t */
Would it be possible to apply this to the current Fedora net-snmp package?
Yep, will be included in net-snmp-5.1-3 and later.
Read ya, Phil
Ok then - any chance of this appearing as an update to Fedora Core 1?
A project I maintain won't compile on FC1 as a result of this problem.
Sure, shouldn't be a problem. I'll make a package for fc1 tomorrow.
Read ya, Phil