Re: ctypes can't find files in /usr/local/lib?

"Joshua J. Kugler" <[email protected]>
Newsgroups gmane.comp.python.ctypes
Organization Azariah Enterprises
Message-ID <[email protected]>
On Saturday 18 September 2010, Larry Bugbee elucidated thus:
> > However, when I try to load them in ctypes, I get:
> >>>> ctypes.cdll.LoadLibrary ("libownet.so")
> >
> > Traceback (most recent call last):
> > File "<input>", line 1, in <module>
> > File "/usr/lib/python2.6/ctypes/__init__.py", line 431, in
> > LoadLibrary return self._dlltype(name)
> > File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
> >   self._handle = _dlopen(self._name, mode)
> > OSError: libownet.so: cannot open shared object file: No such file
> > or directory
>
> Depending on the OS, they may/will have different search paths for
> loading of libraries.  From a page I posted a while ago...
>
>    A few general comments about ctypes
>    -----------------------------------
>      ctypes will look in various locations for shared libraries
>      but where can vary by platform.  Libraries in /usr/lib are
>      pretty much guaranteed to be found, but that may not be the
>      best place for your compiled libraries.  Personally I prefer
>      /usr/local/lib.  Regardless of where, you may need to set
>      and export a load library path appropriate to your platform.
>        LD_LIBRARY_PATH     Linux
>        DYLD_LIBRARY_PATH   Darwin
>        SHLIB_PATH          HP-UX
>        LD_LIBRARY_PATH_32  32-bit Solaris
>        LD_LIBRARY_PATH_64  64-bit Solaris
>
> I hope this helps...  Larry

Yeah, that helps in coming up with a work-around, but doesn't really 
answer the question.  Disclaimer: I know frighteningly little about 
library loading in the *nix world.  I was under he impression that any 
library loader was supposed to reference the ldconfig cache when it was 
trying to load libraries, thus anything the ldconfig cache knew about 
was guaranteed to be loaded.  Can you explain (or point to a document 
explaining) why this isn't so?  Not trolling...just trying to 
understand.

Thanks!

j

-- 
Joshua J. Kugler - Fairbanks, Alaska
Azariah Enterprises - Programming and Website Design
[email protected] - Jabber: [email protected]
PGP Key: http://pgp.mit.edu/  ID 0x73B13B6A

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.