Where to put private lib files?

For example, a lib file is to be used only by one application,
and I don't want to pollute any system wide things (eg: system wide lib directories, system wide variables),
where to put it?
Thanks.
 
Until someone more knowledgeable answers I will offer this:
You may be able to stick your lib anywhere you wish (such as in your home dir maybe: ~/lib) and then just run the "ldconfig" command with your chosen dir as an argument.

So if I'm understanding correctly from ldconfig(8), this might do the trick:
Code:
ldconfig /home/username/lib


Good luck!
 
You can set env var LD_LIBRARY_PATH to set search path for lib
Hower, this ignored by suid apps

You can put into makefile
Code:
LDFLAGS = -rpath /path/to/lib/
To encode search path into app
 
Alt said:
You can set env var LD_LIBRARY_PATH to set search path for lib
Hower, this ignored by suid apps

You can put into makefile
Code:
LDFLAGS = -rpath /path/to/lib/
To encode search path into app


But LD_LIBRARY_PATH is also system wide.
 
jronald said:
But LD_LIBRARY_PATH is also system wide.
Have you tried? ;)


Code:
# ./fcgi-server
/libexec/ld-elf.so.1: Shared object "libsoci_core.so" not found, required by "fcgi-server"
# setenv LD_LIBRARY_PATH /home/alt/projects/cpp/fcgi-server
# ./fcgi-server
fork ok
Anyway you can do -rpath
 
Alt said:
Have you tried? ;)


Code:
# ./fcgi-server
/libexec/ld-elf.so.1: Shared object "libsoci_core.so" not found, required by "fcgi-server"
# setenv LD_LIBRARY_PATH /home/alt/projects/cpp/fcgi-server
# ./fcgi-server
fork ok
Anyway you can do -rpath

I have tried -rpath, it's not ideal. For example:
Let the current directory (.) to be the param of rpath,
and the shared object file and binary file be in the same directory, and the current working directory be different.
It doesn't work.
 
jronald said:
Is there any method to localize the lib file, without polluting any system wide things?

What do you mean "localize". If you want it available for just one user, then use LD_LIBRARY_PATH. It will only "pollute" the current terminal session.

Or you want write a two line script to run your executable:

export LD_LIBRARY_PATH=~/lib/libfunky.so
~/bin/funkyapp
 
Brandybuck said:
What do you mean "localize". If you want it available for just one user, then use LD_LIBRARY_PATH. It will only "pollute" the current terminal session.

Or you want write a two line script to run your executable:

export LD_LIBRARY_PATH=~/lib/libfunky.so
~/bin/funkyapp

I mean the shared library file can be found only by the binary file by default.
Localizing is always better when it is efficient enough, isn't it?
 
Back
Top