bowei_99 has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to install the perl module packaged with net-snmp ver. 5.3.1, the latest stable version. I downloaded from http://net-snmp.sourceforge.net/download.html, and the application itself installs OK, i.e. the commands
cd net-snmp-5.3.1 ./configure --with-perl-modules --enable-shared make make test make install
run fine, with no errors. However, when I cd to the included perl directory (i.e. that comes with the download) and try to do
/usr/bin/perl Makefile.PL make make test
I get the following errors:
PERL_DL_NONLAZY=1 /usr/bin/perl "-I../blib/lib" "-I../blib/arch" test. +pl 1..64 Can't load '../blib/arch/auto/NetSNMP/default_store/default_store.so' +for module NetSNMP::default_store: libnetsnmp.so.10: cannot open shar +ed object file: No such file or directory at /usr/lib/perl5/5.8.5/i38 +6-linux-thread-multi/DynaLoader.pm line 230. at test.pl line 71 Compilation failed in require at test.pl line 71. BEGIN failed--compilation aborted at test.pl line 71. not ok 1 make[1]: *** [test_dynamic] Error 255 make[1]: Leaving directory `/root/netdisco/net-snmp-5.3.1/perl/default +_store' make: *** [test] Error 2
This is even though the default_store.so file is there:
[root@burvil default_store]# ls -l ../blib/arch/auto/NetSNMP/default_s +tore/default_store.so -rwxr-xr-x 1 root root 85559 Sep 14 13:54 ../blib/arch/auto/NetSNMP/d +efault_store/default_store.so You have new mail in /var/spool/mail/root [root@burvil default_store]# pwd /root/netdisco/net-snmp-5.3.1/perl/default_store
as is the libnetsnmp.so.10 file:
[root@burvil perl]# ls -l /usr/local/lib/libnetsnmp.so.10 lrwxrwxrwx 1 root root 20 Sep 13 20:06 /usr/local/lib/libnetsnmp.so.1 +0 -> libnetsnmp.so.10.0.1 [root@burvil perl]# ls -l /usr/local/lib/libnetsnmp.so.10.0.1 -rwxr-xr-x 1 root root 1237224 Sep 13 20:06 /usr/local/lib/libnetsnmp +.so.10.0.1
and the Makefile that's created with perl Makefile.PL has the settings to look in that directory:
LD = gcc LDDLFLAGS = -shared -L/usr/local/lib LDFLAGS = -L/usr/local/lib
I tried installing anyway, ignoring the errors, and the same errors come up when I use it. Also, I need to this particular SNMP module (I know there are others, like SNMP_session), but the perl app I'm installing (netdisco) specifically requires this one. Also, I get the same message when installing a previous version, net-snmp 5.1.4. I'm running perl 5.8.5, gcc 3.4.5 (see below), and RHEL AS 4 Update 3.

[root@burvil perl]# gcc -v Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.5/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man -- +infodir=/usr/share/info --enable-shared --enable-threads=posix --disa +ble-checking --with-system-zlib --enable-__cxa_atexit --disable-libun +wind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux Thread model: posix gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)
Solution: Well, I realized what was wrong. I had installed net-snmp from source on my RHEL AS 4 box, even though it was already installed from rpm. The version from rpm was older. I thought it wouldn't matter, since I specified different directories, but I guess not. I ended up installing netdisco on another system, where I hadn't installed from source, and thus not corrupted the libraries.

-- Burvil

Replies are listed 'Best First'.
Re: Net::SNMP module make test failing
by duckyd (Hermit) on Sep 14, 2006 at 23:02 UTC
    When you configure with --with-perl-modules and do make install in the top level directory, the perl modules should be build and installed for you - no need to go into perl/ and build them yourself.

    Try perldoc NetSNMP::agent

      That's what I thought, too. But the instructions for the application said to do so, and I figured it wouldn't hurt. Yet, when I run the application, I still get the same error as when I tried to install the module:
      [root@burvil perl]# /usr/local/netdisco/netdisco -u root Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/aut +o/NetSNMP/default_store/default_store.so' for module NetSNMP::default +_store: libnetsnmp.so.10: cannot open shared object file: No such fil +e or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLo +ader.pm line 230. at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/SNMP.pm lin +e 16 Compilation failed in require at /usr/lib/perl5/site_perl/5.8.5/i386-l +inux-thread-multi/SNMP.pm line 16. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.5/i3 +86-linux-thread-multi/SNMP.pm line 16. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.5/SNMP/I +nfo.pm line 16. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.5/SN +MP/Info.pm line 16. Compilation failed in require at /usr/local/netdisco/netdisco line 25. BEGIN failed--compilation aborted at /usr/local/netdisco/netdisco line + 25. [root@burvil perl]#
      So, even though perldoc NetSNMP::agent gives me a valid manpage, the error still occurs. What I need is NetSNMP::default_store, not NetSNMP::agent, to avoid the error.

      -- Burvil

        NetSNMP::default_store was also installed fine for me, and can be loaded without any errors.
        $ perl -MNetSNMP::default_store -e 'print "foo\n";' foo
        Shot in the dark, but maybe you need to refresh your ld cache?