Dear Thomas,
As you requested, I am opening a bug report on 5.4.1.pre3 not compiling on hpux 11.23 (itanium) using gcc 4.1.2.
Attached is the output of
gcc -E -I../include -I. -I../snmplib -g -O2 -Uhpux11 -Dhpux11=hpux11 -Wall -Winline -Wstrict-prototypes -
Wwrite-strings -Wcast-qual -Wno-char-subscripts -c system.c -DPIC
Yours truly,
Aleksey
preprocessor output
Logged In: YES
user_id=848638
Originator: NO
More details from the corresponding net-snmp-users thread "5.4.1.pre3 build issues on HP-UX 11.23":
gcc -I../include -I. -I../snmplib -g -O2 -Uhpux11 -Dhpux11=hpux11
-Wall -Winline -Wstrict-prototypes -Wwrite-strings -Wcast-qual
-Wno-char-subscripts -c system.c -DPIC -o .libs/system.o
system.c: In function 'get_myaddr':
system.c:589: error: storage size of 'ifc' isn't known
system.c:605: error: invalid application of 'sizeof' to incomplete
type 'struct ifreq'
system.c:610: error: invalid application of 'sizeof' to incomplete
type 'struct ifreq'
system.c:613: error: invalid application of 'sizeof' to incomplete
type 'struct ifconf'
system.c:644: error: increment of pointer to unknown structure
system.c:644: error: arithmetic on pointer to an incomplete type
system.c:647: error: dereferencing pointer to incomplete type
system.c:650: error: dereferencing pointer to incomplete type
system.c:652: error: invalid application of 'sizeof' to incomplete
type 'struct ifreq'
system.c:655: error: dereferencing pointer to incomplete type
system.c:655: error: 'IFF_UP' undeclared (first use in this function)
system.c:655: error: (Each undeclared identifier is reported only once
system.c:655: error: for each function it appears in.)
system.c:659: error: dereferencing pointer to incomplete type
system.c:666: error: invalid application of 'sizeof' to incomplete
type 'struct ifreq'
system.c:670: error: dereferencing pointer to incomplete type
system.c:589: warning: unused variable 'ifc'
system.c: In function 'strcasestr':
system.c:980: warning: cast discards qualifiers from pointer target type
system.c:1003: warning: cast discards qualifiers from pointer target type
gmake[1]: *** [system.lo] Error 1
gmake[1]: Leaving directory `/var/tsalolia/net-snmp-5.4.1.pre3/snmplib'
gmake: *** [subdirs] Error 1
green01#
(gcc 4.1.2, GNU make 3.81)
Logged In: YES
user_id=848638
Originator: NO
What's the output of "grep HAVE_NET_IF_H include/net-snmp/net-snmp-config.h"? If it's 0, what's the error/snippet of the corresponding test in config.log? If it's 1, is there a proper "struct ifconf" definition in /usr/include/net/if.h? Is it protected by any #ifdef(s)?
Logged In: YES
user_id=180411
Originator: YES
Dear Thomas,
Here is the additional information you asked for:
green01# grep HAVE_NET_IF_H include/net-snmp/net-snmp-config.h
#define HAVE_NET_IF_H 1
green01#
From /usr/include/net/if.h - not protected by any #ifdef:
struct ifconf {
int ifc_len; /* size of associated buffer */
union {
caddr_t ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */
};
Logged In: YES
user_id=848638
Originator: NO
Other things to try while I'm looking into the "gcc -E" output:
- other gcc version (either latest 4.2.0 or older 4.0.4 which works for me)
- bundled cc, but configuring with "--disable-embedded-perl --without-perl-modules" (in case you don't really need Perl)
Please respond with your results.
Logged In: YES
user_id=848638
Originator: NO
Also, can you please post the content of include/net-snmp/net-snmp-config.h after having configured with CC=gcc?
Logged In: YES
user_id=180411
Originator: YES
File Added: config.txt
Logged In: YES
user_id=180411
Originator: YES
File Added: net-snmp-config.h
Logged In: YES
user_id=180411
Originator: YES
Dear Thomas,
1. I have posted the content of include/net-snmp/net-snmp-config.h after having configured with CC=gcc (gcc 4.1.2) this is the file called config.txt
2. Compiling with gcc-4.1.2 and gmake-3.81 dies as follows:
gcc -I../include -I. -I../snmplib -g -O2 -Uhpux11 -Dhpux11=hpux11 -c system.c -DPIC -o .libs/system.o
system.c: In function 'get_myaddr':
system.c:589: error: storage size of 'ifc' isn't known
system.c:605: error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
system.c:610: error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
system.c:613: error: invalid application of 'sizeof' to incomplete type 'struct ifconf'
system.c:644: error: increment of pointer to unknown structure
system.c:644: error: arithmetic on pointer to an incomplete type
system.c:647: error: dereferencing pointer to incomplete type
system.c:650: error: dereferencing pointer to incomplete type
system.c:652: error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
system.c:655: error: dereferencing pointer to incomplete type
system.c:655: error: 'IFF_UP' undeclared (first use in this function)
system.c:655: error: (Each undeclared identifier is reported only once
system.c:655: error: for each function it appears in.)
system.c:659: error: dereferencing pointer to incomplete type
system.c:666: error: invalid application of 'sizeof' to incomplete type 'struct ifreq'
system.c:670: error: dereferencing pointer to incomplete type
gmake[1]: *** [system.lo] Error 1
gmake[1]: Leaving directory `/var/tsalolia/net-snmp-5.4.1.rc2/snmplib'
gmake: *** [subdirs] Error 1
green01#
3. compiling with bundled cc and gmake-3.81 dies (and without embedded perl and without perl modules) as follows:
cc -b -Wl,+h -Wl,libnetsnmpagent.so.16 -Wl,+nodefaultrpath -o .libs/libnetsnmpagent.so.16.0 .libs/snmp_agent.o .libs/snmp_vars.o .libs/agent_read_config.o .libs/agent_registry.o .libs/agent_index.o .libs/agent_trap.o .libs/kernel.o .libs/agent_handler.o mibgroup/snmpv3/.libs/usmConf.o mibgroup/agentx/.libs/master.o mibgroup/agentx/.libs/subagent.o mibgroup/utilities/.libs/execute.o mibgroup/utilities/.libs/iquery.o mibgroup/mibII/.libs/vacm_conf.o mibgroup/agentx/.libs/protocol.o mibgroup/agentx/.libs/client.o mibgroup/agentx/.libs/master_admin.o mibgroup/agentx/.libs/agentx_config.o +b /var/tsalolia/net-snmp-5.4.1.rc2/snmplib/.libs ../snmplib/.libs/libnetsnmp.so -lc
(Bundled) cc: warning 922: "-b" is unsupported in the bundled compiler, ignored.
(Bundled) cc: warning 957: The +b/var/tsalolia/net-snmp-5.4.1.rc2/snmplib/.libs option is neither supported nor required on IPF.
ld: Unknown input file type: "../snmplib/.libs/libnetsnmp.so"
Fatal error.
gmake[1]: *** [libnetsnmpagent.la] Error 1
gmake[1]: Leaving directory `/var/tsalolia/net-snmp-5.4.1.rc2/agent'
gmake: *** [subdirs] Error 1
green01#
4. compiling with gcc-4.2.0 and gmake-3.81 (without embedded perl or perl modules) dies as follows:
gcc -shared -Wl,+h -Wl,libnetsnmpagent.so.16 -Wl,+nodefaultrpath -o .libs/libnetsnmpagent.so.16.0 .libs/snmp_agent.o .libs/snmp_vars.o .libs/agent_read_config.o .libs/agent_registry.o .libs/agent_index.o .libs/agent_trap.o .libs/kernel.o .libs/agent_handler.o mibgroup/snmpv3/.libs/usmConf.o mibgroup/agentx/.libs/master.o mibgroup/agentx/.libs/subagent.o mibgroup/utilities/.libs/execute.o mibgroup/utilities/.libs/iquery.o mibgroup/mibII/.libs/vacm_conf.o mibgroup/agentx/.libs/protocol.o mibgroup/agentx/.libs/client.o mibgroup/agentx/.libs/master_admin.o mibgroup/agentx/.libs/agentx_config.o +b /var/tsalolia/net-snmp-5.4.1.rc2/snmplib/.libs ../snmplib/.libs/libnetsnmp.so -lc
gcc: +b: No such file or directory
gmake[1]: *** [libnetsnmpagent.la] Error 1
gmake[1]: Leaving directory `/var/tsalolia/net-snmp-5.4.1.rc2/agent'
gmake: *** [subdirs] Error 1
green01#
I have uploaded a copy of my net-snmp-config.h from this build as well, this is the file called net-snmp-config.h
I do appreciate your help thus far, please continue.
Yours Sincerely,
Alex
Logged In: YES
user_id=848638
Originator: NO
If config.txt is the version of net-snmp-config.h with gcc 4.1.2, then this is exactly what I suspected: HAVE_NET_IF_H is *not* defined which is exactly the reason why the build fails. Please look into the corresponding config.log file (and post it), so we can find out why.
If HAVE_NET_IF_H *is* defined with gcc 4.2.0, then what's the build error with that one?
You also haven't answered my previous question yet on how the bundled cc performs if you configure without Perl support.
For the future, please always make it very clear here what exact compiler version a certain information/test corresponds to, otherwise we'll easily cause confusion. At the moment, we handle three (bundled cc, gcc 4.1.2, gcc 4.2.0) in parallel and they all behave fundamentally different.
Logged In: YES
user_id=180411
Originator: YES
Dear Thomas,
Here is additional information you asked for. I have included the following for each of the three compilers:
config.log
include/net-snmp/net-snmp-config.h
the build error
The attached file is called 1742278.tar.gz
Yours truly,
Aleksey
Logged In: YES
user_id=180411
Originator: YES
File Added: 1742278.tar.gz
Logged In: YES
user_id=848638
Originator: NO
Re bundled cc build error: What's the output of "file snmplib/.libs/libnetsnmp.so"?
Re gcc 4.2.0 build error: Please try starting again from scratch (unpack, configure, make). The build shouldn't use "+b" at link time, so I'd assume that's some leftover from an earlier build with a different compiler. If it still fails, please also post the full make output.
In general, I'd recommend to use completely different build directories when testing with the three compilers you have.
Re gcc 4.1.2 build error: according to your logs, the configure check for <net if.h=""> fails with
configure:33198: checking for net/if.h
configure:33257: gcc -c -g -O2 -Uhpux11 -Dhpux11=hpux11 conftest.c >&5
In file included from /usr/include/sys/mp.h:53,
from /usr/include/sys/malloc.h:59,
from /usr/include/net/netmp.h:51,
from /usr/include/net/if.h:59,
from conftest.c:160:
/usr/include/machine/sys/getppdp.h:65: error: array type has incomplete element type
Since 4.2.0 works fine in this regard, I'd guess that's a problem with your particular gcc 4.1.2 installation.
contains log of make using gcc-4.2.0
Logged In: YES
user_id=180411
Originator: YES
File Added: 1742278.tar.gz
Logged In: YES
user_id=180411
Originator: YES
Dear Thomas,
Thanks for your reply.
Since the config check shows a problem with my particular gcc 4.1.2 installation,
I decided continue with bundled cc and gcc 4.2.0.
I created separate build directories for net-snmp-bundled-cc and net-snmp-gcc-4.2.0.
The output of "file snmplib/.libs/libnetsnmp.so" from the bundled-cc directory is
snmplib/.libs/libnetsnmp.so: ELF-32 executable object file - IA64
I have attached a new tar-ball with the full make log from gcc-4.2.0 as you requested
as well as the config log and the net-snmp-config.h file from each build (for your reference).
Yours sincerely,
Aleksey
Logged In: YES
user_id=848638
Originator: NO
re bundled cc: looks like it's too crippled to link libraries against libraries. Let's put it aside for the moment.
re gcc 4.2.0: for reasons yet to be determined, libtool adds "+b /some/path" when linking a shared library while it should add "-Wl,+b -Wl,/some/path". Each time make fails, can you try calling gcc manually with the command that's printed last (from within the corresponding subdirectory), but with the "-Wl," change? Then continue with make and so on. It's an ugly workaround, but may get you to a working build.
Logged In: YES
user_id=848638
Originator: NO
Or, better, make sure you have the following line in top-level libtool (*after* running configure):
hardcode_libdir_flag_spec_ld="\${wl}+b \${wl}\$libdir"
(instead of the original hardcode_libdir_flag_spec_ld line). Works for me. Please report back.
Logged In: YES
user_id=180411
Originator: YES
YAY!! I was able to build rc2 and rc3 by making the edit in "libtool" file. Thanks, Thomas!! Great help.
Yours truly,
Aleksey
Logged In: YES
user_id=848638
Originator: NO
Thanks for the bug report!
We've fixed the problem in the 5.4.x code branch
and the main development tree, so it should be
fixed in future releases of the Net-SNMP package.
Logged In: YES
user_id=848638
Originator: NO
We've upgraded to libtool 1.5.24 in SVN Rev. 16559 and 16620. The fix will be in 5.4.1.rc4.