1. Path for Linux .so fies

All,

Boy, talk about culture shock!

I began working in earnest on a Linux port for my iSeries Toolbox for 
Euphoria and ran into a slight problem (maybe just a difference between 
Windows and Linux).  

In Windows when you use open_dll() it searches the path for the .dll.  
Obviously not so in Linux.  I had to specifically spell out the path to 
the .so!  Is this just a difference between the two or am I missing 
something?

Thanks!

Jonas

new topic     » topic index » view message » categorize

2. Re: Path for Linux .so fies

--- Jonas  Temple <jtemple at yhti.net> wrote:

> In Windows when you use open_dll() it searches the
> path for the .dll.  
> Obviously not so in Linux.  I had to specifically
> spell out the path to 
> the .so!  Is this just a difference between the two
> or am I missing 
> something?

You're missing something :)

Basically, it looks for the .so in /usr/lib, and 
then in /lib, so that's where the file should be put.
If you don't want to do that, you can set the
environment variable LD_LIBRARY_PATH to point to where
the .so is located. 
Or, you can run ldconfig to set up links to .so files 
in other non-standard places.

Type 'man ld.so' and 'man ldconfig' to see how Linux 
handles these things.

Irv

new topic     » goto parent     » topic index » view message » categorize

3. Re: Path for Linux .so fies

Hello Jonas,

Linux (and other UNIX implementations) don't use the PATH environment
variable to find shared libraries.  Another environment variable is used.
On HP-UX for example the environment variable is LD_LIBRARY_PATH.  On other
UNIX's I think it might be LIBPATH or something like that.

If the particular environment variable for shared library location is not
defined then I think the default is to look in /lib and /usr/lib only.  I
believe that by default it will not search the current directory.

Where is your library located?  If you have permission on your Linux box
get the library copied to /lib and/or /usr/lib and see if you can open_dll
without the full pathname.

Good luck.

Regards,

Andy Cranston.

At 03:57 24/09/03 +0000, you wrote:
>
>
>All,
>
>Boy, talk about culture shock!
>
>I began working in earnest on a Linux port for my iSeries Toolbox for 
>Euphoria and ran into a slight problem (maybe just a difference between 
>Windows and Linux).  
>
>In Windows when you use open_dll() it searches the path for the .dll.  
>Obviously not so in Linux.  I had to specifically spell out the path to 
>the .so!  Is this just a difference between the two or am I missing 
>something?
>
>Thanks!
>
>Jonas
>
>--^----------------------------------------------------------------
>This email was sent to: andy at systemzone.freeserve.co.uk
>
>
>TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Path for Linux .so fies

>From: eugtk at yahoo.com
>Subject: Re: Path for Linux .so fies
>
>
>--- Jonas  Temple <jtemple at yhti.net> wrote:
>
> > In Windows when you use open_dll() it searches the
> > path for the .dll.
> > Obviously not so in Linux.  I had to specifically
> > spell out the path to
> > the .so!  Is this just a difference between the two
> > or am I missing
> > something?
>
>You're missing something :)
>
>Basically, it looks for the .so in /usr/lib, and
>then in /lib, so that's where the file should be put.
>If you don't want to do that, you can set the
>environment variable LD_LIBRARY_PATH to point to where
>the .so is located.
>Or, you can run ldconfig to set up links to .so files
>in other non-standard places.
>
>Type 'man ld.so' and 'man ldconfig' to see how Linux
>handles these things.
>
>Irv
>

  Yes, but remember to be root to run ldconfig. Also, if you are trying to 
open a shared library from the current directory, then you should remember 
to put the "./", ie: my_so = open_dll("./mySharedLib.so") Oh, and don't 
forget, it's case-sensitive.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Path for Linux .so fies

On Wed, Sep 24, 2003 at 07:29:14PM +0100, andy at systemzone.freeserve.co.uk
wrote:
> 
> 
> Hello Jonas,
> 
> Linux (and other UNIX implementations) don't use the PATH environment
> variable to find shared libraries.  Another environment variable is used.
> On HP-UX for example the environment variable is LD_LIBRARY_PATH.  On other
> UNIX's I think it might be LIBPATH or something like that.

Its LD_LIBRARY_PATH in Linux.

> 
> If the particular environment variable for shared library location is not
> defined then I think the default is to look in /lib and /usr/lib only.  I
> believe that by default it will not search the current directory.

Right, current directory is not checked. Only /lib and the directories
in /etc/ld.so.cache are checked. ld.so.cache is binary data but the text
version is in ld.so.conf.

BTW I am not sure, I dont think /usr/lib is checked by default.

> 
> Where is your library located?  If you have permission on your Linux box
> get the library copied to /lib and/or /usr/lib and see if you can open_dll
> without the full pathname.

Personally, I'd just require the so library to be in the same directory
as the program (which can be determined from the second parameter of
command_line()
btw) and then load the full path from there. Much simpler.

> 
> Good luck.
> 
> Regards,
> 
> Andy Cranston.
> 
> At 03:57 24/09/03 +0000, you wrote:
> >
> >
> >All,
> >
> >Boy, talk about culture shock!
> >
> >I began working in earnest on a Linux port for my iSeries Toolbox for 
> >Euphoria and ran into a slight problem (maybe just a difference between 
> >Windows and Linux).  
> >
> >In Windows when you use open_dll() it searches the path for the .dll.  
> >Obviously not so in Linux.  I had to specifically spell out the path to 
> >the .so!  Is this just a difference between the two or am I missing 
> >something?
> >
> >Thanks!
> >
> >Jonas
> >
> >
> >TOPICA - Start your own email discussion group. FREE!
> >
> >
> 
> 
> TOPICA - Start your own email discussion group. FREE!
> 
> 

-- 
You too can spend five years in prison; just distribute this program
once US Senator Hollings's CBDTPA bill is passed into law:
perl -e 'while(<>) { print;}'

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu