How to get past this solaris netsnmp_get_version missing symbol problem.

Executive summary:

 1. Install gcc and add location of libnetsnmp.so into gcc path spec

   # open-solaris blastwave libnetsnmp.so in /opt/csw/lib  
   crle -u -l /opt/csw/lib

 2. Override python's ctypes/utils.py find_library (as it is done for FreeBSD, 
in pynetsnmp/netsnmp.py). 
   
   This will work for you if you wish to not install gcc.

   Edit pynetsnmp/netsnmp.py 
   Hijack the FreeBSD override of find_library by matching platform with 
"sunos" instead of "free"
   Add path where libnetsnmp.so is located to list.


Python is calling gcc as it is trying to find dynamic library libnetsnmp.so.
Look in ctypes/util.py, 2 methods are used, a call to /sbin/ldconfig or to gcc.
/sbin/ldconfig doesn't exist on solaris 10?
You can see the test to find the lib with gcc is like this:

   [EMAIL PROTECTED]:/ #  /usr/local/bin/gcc -Wl,-t -lnetsnmp

If you also don't have gcc installed on solaris then python ctypes/utils.py 
cannot find any libs.
I had gcc installed and libnetsnmp.so in /opt/csw/lib (from open solaris 
blastwave package).
The gcc installed did not have /opt/csw/lib configured as library path to 
search.

Editing the find_library method override in pynetsnmp/netsnmp.py is a more 
certain solution (no
external dependancy on gcc or ldconfig). It was overridden for FreeBSD, 
platform matching "free".
Edit it so that for solaris if platform matches "sunos" then override this 
method and add /opt/csw/lib
(or whereever your libnetsnmp.so is). 

Interesting here: the latest python ctypes/util.py matches platform with sunos5 
and calls `/usr/ccs/bin/dump -Lpv`
http://svn.python.org/view/python/trunk/Lib/ctypes/util.py?rev=58155&view=auto
It still doesn't look perfect (on solaris objdump or even gobjdump should also 
be an option).


File locations, for reference:

 $ZENHOME/lib/python/ctypes/util.py
 ./build/ctypes-1.0.1/ctypes/util.py
 ./build/ctypes-1.0.1/build/lib.solaris-2.10-sun4v-2.4/ctypes/util.py

 $ZENHOME/lib/python/pynetsnmp/netsnmp.py 
 ./build/pynetsnmp-0.27.0/netsnmp.py
 ./build/pynetsnmp-0.27.0/build/lib/pynetsnmp/netsnmp.py


The top bit of pynetsnmp/netsnmp.py changed from FreeBSD to Solaris and with 
added /opt/csw/lib:

import os
from ctypes import *
from ctypes.util import find_library
from CONSTANTS import *

# freebsd cannot manage a decent find_library
import sys
if sys.platform.find('sunos') > -1:
    find_library_orig = find_library
    def find_library(name):
        for name in ['/usr/lib/lib%s.so' % name,
                     '/usr/local/lib/lib%s.so' % name,
                     '/opt/csw/lib/lib%s.so' % name]:
            if os.path.exists(name):
                return name
        return find_library_orig(name)




-------------------- m2f --------------------

Read this topic online here:
http://community.zenoss.com/forums/viewtopic.php?p=17941#17941

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to