🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
4 messages
4 total messages Started by Thomas Conner Annandale Wed, 02 Oct 2002 02:46
ld.so, how do I include my own libraries?
#3346
Author: Thomas Conner Annandale
Date: Wed, 02 Oct 2002 02:46
33 lines
2287 bytes
First off, I barely know what I'm talking about, so please bear with me.

I'm on a Linux box for which I do not have root privileges.  I have
created a program which uses shared library (?) files which are not in the
standard paths.  I compile my program with -lSDL_gfx, and I have a
directory with the files:

  libSDL_gfx.a 
  libSDL_gfx.so
  libSDL_gfx.so.0.0.0
  libSDL_gfx.la
  libSDL_gfx.so.0

When I try to run my program, I get this:

  ./ServerDriver: error while loading shared libraries: libSDL_gfx.so.0:  
  cannot open shared object file: No such file or directory

What do I do to make the executable aware of the directory where it can 
find the share library?  Remember, I don't have root access.  I read in 
the 'man ld.so' file that I can set the LD_LIBRARY_PATH environment 
variable to tell it where to find my libraries, so in bash I typed:

  LD_LIBRARY_PATH=/net/hu2/lonely/cs4455/SDL_gfx-2.0.3/local/lib

which is the full directory where the shared library files libSDL_gfx.* 
files are stored, but it still gives me the same error when I try to run 
my program.  What do I do?


-- 
Thomas
www.boredatheist.com
Re: ld.so, how do I include my own libraries?
#3347
Author: David Shea
Date: Wed, 02 Oct 2002 03:14
8 lines
1286 bytes
Thomas Conner Annandale uttered...
>   LD_LIBRARY_PATH=/net/hu2/lonely/cs4455/SDL_gfx-2.0.3/local/lib

You need to export the variable, otherwise it will only be local to the
shell.  So, in bash, export LD_LIBRARY_PATH=whatever

-- 
David Shea
Re: ld.so, how do I include my own libraries?
#3348
Author: Nils O. Selåsdal
Date: Wed, 02 Oct 2002 07:21
39 lines
2701 bytes
> First off, I barely know what I'm talking about, so please bear with me.
> 
> I'm on a Linux box for which I do not have root privileges.  I have
> created a program which uses shared library (?) files which are not in the
> standard paths.  I compile my program with -lSDL_gfx, and I have a
> directory with the files:
> 
>   libSDL_gfx.a 
>   libSDL_gfx.so
>   libSDL_gfx.so.0.0.0
>   libSDL_gfx.la
>   libSDL_gfx.so.0
> 
> When I try to run my program, I get this:
> 
>   ./ServerDriver: error while loading shared libraries: libSDL_gfx.so.0:  
>   cannot open shared object file: No such file or directory
> 
> What do I do to make the executable aware of the directory where it can 
> find the share library?  Remember, I don't have root access.  I read in 
> the 'man ld.so' file that I can set the LD_LIBRARY_PATH environment 
> variable to tell it where to find my libraries, so in bash I typed:
> 
>   LD_LIBRARY_PATH=/net/hu2/lonely/cs4455/SDL_gfx-2.0.3/local/lib
> 
> which is the full directory where the shared library files libSDL_gfx.* 
> files are stored, but it still gives me the same error when I try to run 
> my program.  What do I do?
You can set the LD_LIBRARY_PATH to include the path where the libraries
are nefore running your program. Or you can hardcode the searchpath in the 
binary. e.g. give gcc -Wl,-R /another/path at the linking stage.

-- 
Vennlig hilsen/Best Regards
Nils Olav Sel�sdal
System Engineer
UtelSystems a/s
Tlf: +47 370 45 431
w w w . u t e l s y s t e m s . c o m
Re: ld.so, how do I include my own libraries?
#3349
Author: Sony Antony
Date: Wed, 02 Oct 2002 20:06
13 lines
1577 bytes
> >   LD_LIBRARY_PATH=/net/hu2/lonely/cs4455/SDL_gfx-2.0.3/local/lib
> > 
> > which is the full directory where the shared library files libSDL_gfx.* 
> > files are stored, but it still gives me the same error when I try to run 
> > my program.  What do I do?
> You can set the LD_LIBRARY_PATH to include the path where the libraries
> are nefore running your program. Or you can hardcode the searchpath in the 
> binary. e.g. give gcc -Wl,-R /another/path at the linking stage.

And if both -R switch and LD_LIBRARY_PATH are used, LD_LIBRARY_PATH
will take precedence.

--sony
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads