[Python-Dev] problems importing _tkinter on Linux build

Thomas Wouters thomas@xs4all.net
Wed, 20 Sep 2000 15:23:10 +0200


On Sun, Sep 17, 2000 at 02:46:14PM -0700, Trent Mick wrote:
> On Sun, Sep 17, 2000 at 02:27:18PM -0700, Trent Mick wrote:
> > 
> > I get the following error trying to import _tkinter in a Python 2.0 build:
> > 
> > > ./python
> > ./python: error in loading shared libraries: libtk8.3.so: cannot open shared object file: No such file or directory
> > 

> Duh, learning about LD_LIBRARY_PATH (set LD_LIBRARY_PATH to /usr/local/lib)
> and everything is hunky dory. I presumed that /usr/local/lib would be
> on the default search path for shared libraries. Bad assumption I guess.

On *some* ELF systems (at least Linux and BSDI) you can add /usr/local/lib
to /etc/ld.so.conf and rerun 'ldconfig' (which builds the cachefile
/etc/ld.so.cache, which is used as the 'searchpath'.) I personally find this
a lot better approach than the LD_LIBRARY_PATH or -R/-rpath approaches,
especially for 'system-wide' shared libraries (you can use one of the other
approaches if you want to tie a specific binary to a specific shared library
in a specific directory, or have a binary use a different shared library
(from a different directory) in some of the cases -- though you can use
LD_PRELOAD and such for that as well.)

If you tie your binary to a specific directory, you might lose portability,
necessitating ugly script-hacks that find & set a proper LD_LIBRARY_PATH or
LD_PRELOAD and such before calling the real program. I'm not sure if recent
SunOS's support something like ld.so.conf, but old ones didn't, and I sure
wish they did ;)

Back-from-vacation-and-trying-to-catch-up-on-2000+-mails-ly y'rs,
-- 
Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!