[Python-Dev] problems importing _tkinter on Linux build

Trent Mick trentm@ActiveState.com
Mon, 18 Sep 2000 09:39:04 -0700


On Mon, Sep 18, 2000 at 09:35:32AM -0400, Barry A. Warsaw wrote:
> 
> >>>>> "TM" == Trent Mick <trentm@ActiveState.com> writes:
> 
>     TM> Duh, learning about LD_LIBRARY_PATH (set LD_LIBRARY_PATH to
>     TM> /usr/local/lib) and everything is hunky dory. I presumed that
>     TM> /usr/local/lib would be on the default search path for shared
>     TM> libraries. Bad assumption I guess.
> 
> Also, look at the -R flag to ld.  In my experience (primarily on
> Solaris), any time you compiled with a -L flag you absolutely /had/ to
> include a similar -R flag, otherwise you'd force all your users to set
> LD_LIBRARY_PATH.
> 

Thanks, Barry. Reading about -R led me to -rpath, which works for me. Here is
the algorithm from the info docs:

`-rpath-link DIR'
     When using ELF or SunOS, one shared library may require another.
     This happens when an `ld -shared' link includes a shared library
     as one of the input files.

     When the linker encounters such a dependency when doing a
     non-shared, non-relocateable link, it will automatically try to
     locate the required shared library and include it in the link, if
     it is not included explicitly.  In such a case, the `-rpath-link'
     option specifies the first set of directories to search.  The
     `-rpath-link' option may specify a sequence of directory names
     either by specifying a list of names separated by colons, or by
     appearing multiple times.

     The linker uses the following search paths to locate required
     shared libraries.
       1. Any directories specified by `-rpath-link' options.

       2. Any directories specified by `-rpath' options.  The difference
          between `-rpath' and `-rpath-link' is that directories
          specified by `-rpath' options are included in the executable
          and used at runtime, whereas the `-rpath-link' option is only
          effective at link time.

       3. On an ELF system, if the `-rpath' and `rpath-link' options
          were not used, search the contents of the environment variable
          `LD_RUN_PATH'.

       4. On SunOS, if the `-rpath' option was not used, search any
          directories specified using `-L' options.

       5. For a native linker, the contents of the environment variable
          `LD_LIBRARY_PATH'.

       6. The default directories, normally `/lib' and `/usr/lib'.

     For the native ELF linker, as the last resort, the contents of
     /etc/ld.so.conf is used to build the set of directories to search.

     If the required shared library is not found, the linker will issue
     a warning and continue with the link.


Trent


-- 
Trent Mick
TrentM@ActiveState.com