Subject: Re: Buiding net-snmp perl in cygwin - Please anyone help me
From: "Gerrit P. Haase" <[email-masked]>
To: Aparna R <[email-masked]>
Cc: [email-masked]
Date: Fri, 04 Mar 2005 21:12:41 +0100

Hi,

comments below.

> Currently I uninstalled activeperl and I am having cygwin perl alone and
> correspondingly I changed the Path variable to D:\cygwin\bin.
> 
> Herewith I am attcahing the output of "perl Makefile.PL", "make" 
> 
> $ make
> [...snip...]
> 
> LD_RUN_PATH="" ld2  -s -L/usr/local/lib agent.o  -o .../blib/arch/auto/NetSNMP/agent/agent.dll /usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a -L/usr/local/lib -lnetsnmpagent -lnetsnmpmibs -lnetsnmphelpers -lnetsnmp -lm
> gcc -shared -o agent.dll -Wl,--out-implib=libagent.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--stack,8388608 \
> -s -L/usr/local/lib agent.o /usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a -L/usr/local/lib -lnetsnmpagent -lnetsnmpmibs -lnetsnmphelpers -lnetsnmp -lm
> Creating library file: libagent.dll.a
> /usr/local/lib/libnetsnmpmibs.a(udpTable.o)(.text+0x580): In function `udpTable_load':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/udpTable.c:568: undefined reference to `_GetUdpTable@12'
> /usr/local/lib/libnetsnmpmibs.a(udpTable.o)(.text+0x726):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/udpTable.c:575: undefined reference to `_GetUdpTable@12'
> /usr/local/lib/libnetsnmpmibs.a(tcpTable.o)(.text+0x65a): In function `tcpTable_load':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/tcpTable.c:659: undefined reference to `_GetTcpTable@12'
> /usr/local/lib/libnetsnmpmibs.a(tcpTable.o)(.text+0x828):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/tcpTable.c:666: undefined reference to `_GetTcpTable@12'
> /usr/local/lib/libnetsnmpmibs.a(var_route.o)(.text+0x39e): In function `var_ipRouteEntry':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/var_route.c:1492: undefined reference to `_GetIpForwardTable@12'
> /usr/local/lib/libnetsnmpmibs.a(var_route.o)(.text+0x5a9):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/var_route.c:1499: undefined reference to `_GetIpForwardTable@12'
> /usr/local/lib/libnetsnmpmibs.a(extend.o)(.text+0x537): In function `extend_load_cache':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/agent/extend.c:218: undefined reference to `_run_shell_command'
> /usr/local/lib/libnetsnmpmibs.a(extend.o)(.text+0x6a1):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/agent/extend.c:220: undefined reference to `_run_exec_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0x9b7): In function `var_extensible_shell':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:470: undefined reference to `_run_shell_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0xa60):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:467: undefined reference to `_run_exec_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0xab4):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:459: undefined reference to `_run_shell_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0xaef):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:456: undefined reference to `_run_exec_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0xfa3): In function `var_extensible_relocatable':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:597: undefined reference to `_run_shell_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0x10d4):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:594: undefined reference to `_run_exec_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0x114c):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:587: undefined reference to `_run_shell_command'
> /usr/local/lib/libnetsnmpmibs.a(extensible.o)(.text+0x1193):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/ucd-snmp/extensible.c:584: undefined reference to `_run_exec_command'
> /usr/local/lib/libnetsnmpmibs.a(udp.o)(.text+0x491): In function `udp_load':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/udp.c:462: undefined reference to `_GetUdpStatistics@4'
> /usr/local/lib/libnetsnmpmibs.a(icmp.o)(.text+0x541): In function `icmp_load':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/icmp.c:669: undefined reference to `_GetIcmpStatistics@4'
> /usr/local/lib/libnetsnmpmibs.a(tcp.o)(.text+0x521): In function `tcp_load':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/tcp.c:649: undefined reference to `_GetTcpStatistics@4'
> /usr/local/lib/libnetsnmpmibs.a(ip.o)(.text+0x811): In function `ip_load':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/ip.c:748: undefined reference to `_GetIpStatistics@4'
> /usr/local/lib/libnetsnmpmibs.a(interfaces.o)(.text+0x1c3): In function `header_ifEntry':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/interfaces.c:2562: undefined reference to `_GetIfTable@12'
> /usr/local/lib/libnetsnmpmibs.a(interfaces.o)(.text+0x4ad):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/interfaces.c:2573: undefined reference to `_GetIfTable@12'
> /usr/local/lib/libnetsnmpmibs.a(interfaces.o)(.text+0x5d9): In function `var_interfaces':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/interfaces.c:2621: undefined reference to `_GetNumberOfInterfaces@4'
> /usr/local/lib/libnetsnmpmibs.a(interfaces.o)(.text+0x6ed): In function `var_ifEntry':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/interfaces.c:2654: undefined reference to `_GetIfEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(interfaces.o)(.text+0x9f2): In function `writeIfEntry':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/interfaces.c:2797: undefined reference to `_SetIfEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0x19f): In function `var_atEntry':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:855: undefined reference to `_GetIpNetTable@12'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0x5dd):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:862: undefined reference to `_GetIpNetTable@12'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0x95d): In function `write_arp':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1135: undefined reference to `_SetIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0x9bb):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1119: undefined reference to `_SetIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0x9e6):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1124: undefined reference to `_SetIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0xa5a):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1091: undefined reference to `_SetIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0xacb):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1192: undefined reference to `_CreateIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0xb7e):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1172: undefined reference to `_SetIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(at.o)(.text+0xbbd):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/at.c:1162: undefined reference to `_SetIpNetEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(route_write.o)(.text+0x40e): In function `write_rte':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/route_write.c:756: undefined reference to `_CreateIpForwardEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(route_write.o)(.text+0x444):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/route_write.c:729: undefined reference to `_SetIpForwardEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(route_write.o)(.text+0x47d):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/route_write.c:743: undefined reference to `_SetIpForwardEntry@4'
> /usr/local/lib/libnetsnmpmibs.a(ipAddr.o)(.text+0x93): In function `var_ipAddrEntry':/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/ipAddr.c:977: undefined reference to `_GetIpAddrTable@12'
> /usr/local/lib/libnetsnmpmibs.a(ipAddr.o)(.text+0x358):/cygdrive/d/net-snmp-5.2.1/agent/mibgroup/mibII/ipAddr.c:981: undefined reference to `_GetIpAddrTable@12'
> 
> collect2: ld returned 1 exit status
> perlld: *** system() failed to execute
> gcc -shared -o
>  agent.dll -Wl,--out-implib=libagent.dll.a -Wl,--export-all-symbo
> ls -Wl,--enable-auto-import -Wl,--stack,8388608 \
> -s -L/usr/local/lib agent.o
>  /usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a -L/usr
> /local/lib -lnetsnmpagent -lnetsnmpmibs -lnetsnmphelpers -lnetsnmp -lm
> 
> make[1]: *** [../blib/arch/auto/NetSNMP/agent/agent.dll] Error 1
> make[1]: Leaving directory `/cygdrive/d/net-snmp-5.2.1/perl/agent'
> make: *** [subdirs] Error 2

So this is the full error message.  Alright, at first figure out where 
the missing symbols are defined, e.g.:

$ find /usr/local/lib -name "*.a" | xargs grep _SetIpNetEntry

Maybe in one of the snmp libraries, ie. libnetsnmpagent.a

than try to change the link order from:
-lnetsnmpagent -lnetsnmpmibs -lnetsnmphelpers -lnetsnmp
to:
-lnetsnmpmibs -lnetsnmpagent -lnetsnmphelpers -lnetsnmp

Issue the command manually in the directory where the object files are
and see if it works:
$ gcc -shared -o agent.dll \
    -Wl,--out-implib=libagent.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--stack,8388608 \
    -s -L/usr/local/lib agent.o \
    usr/lib/perl5/5.8/cygwin/CORE/libperl.dll.a \
    -L/usr/local/lib -lnetsnmpmibs \
    -lnetsnmpagent -lnetsnmphelpers -lnetsnmp

If so, try to figure out what to change in Makefile.PL to reorder the
link command.

If this all fails, the submit a bug report to the address which should
be included in the README file.

Gerrit

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/