I have solved this but now cannot recall the syntax. I want to strip or change the hard wired library paths on binaries I download from a repository. I do not have root and just want a personal install, but would rather not build every tool. I even posted the solution here once for others, but cannot find it.
$ bzip2 --help
/usr/lib/dld.sl: Can't open shared library: /usr/local/lib/libbz2.sl
/usr/lib/dld.sl: No such file or directory
Abort
$ whence bzip2
~/myroot/usr/local/bin/bzip2
$ find myroot -name libbz2.sl
myroot/usr/local/lib/libbz2.sl
$
---------- Post updated at 03:45 PM ---------- Previous update was at 02:53 PM ----------
I did something right, and now it works:
$ chatr +s enable -l /usr/local/lib/libbz2.sl myroot/usr/local/bin/bzip2
myroot/usr/local/bin/bzip2:
current values:
shared executable
shared library dynamic path search:
SHLIB_PATH enabled second
embedded path disabled first Not Defined
shared library list:
static /usr/local/lib/libbz2.sl
dynamic /usr/lib/libc.2
shared library binding:
deferred
global hash table disabled
plabel caching disabled
global hash array size:1103
global hash array nbuckets:3
shared vtable support disabled
explicit unloading enabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled
shared library text merging disabled
new values:
shared executable
shared library dynamic path search:
SHLIB_PATH enabled second
embedded path disabled first Not Defined
shared library list:
dynamic /usr/local/lib/libbz2.sl
dynamic /usr/lib/libc.2
shared library binding:
deferred
global hash table disabled
plabel caching disabled
global hash array size:1103
global hash array nbuckets:3
shared vtable support disabled
explicit unloading enabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled
shared library text merging disabled
$ bzip2 --help
bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010.
usage: bzip2 [flags and input files in any order]
-h --help print this message
-d --decompress force decompression
-z --compress force compression
-k --keep keep (don't delete) input files
-f --force overwrite existing output files
-t --test test compressed file integrity
-c --stdout output to standard out
-q --quiet suppress noncritical error messages
-v --verbose be verbose (a 2nd -v gives more)
-L --license display software version & license
-V --version display software version & license
-s --small use less memory (at most 2500k)
-1 .. -9 set block size to 100k .. 900k
--fast alias for -1
--best alias for -9
If invoked as `bzip2', default action is to compress.
as `bunzip2', default action is to decompress.
as `bzcat', default action is to decompress to stdout.
If no file names are given, bzip2 compresses or decompresses
from standard input to standard output. You can combine
short flags, so `-v -4' means the same as -v4 or -4v, &c.
$ ldd -rsv local/bin/bzip2
find library=/usr/lib/libc.2; required by local/bin/bzip2
search path=/usr/lib:/usr/local/lob:/dhome1/n/nbkodln/local/lib (SHLIB_PATH)
trying path=/usr/lib/libc.2
/usr/lib/libc.2 => /usr/lib/libc.2
find library=/usr/lib/libdld.2; required by /usr/lib/libc.2
search path=/usr/lib:/usr/local/lob:/dhome1/n/nbkodln/local/lib (SHLIB_PATH)
trying path=/usr/lib/libdld.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
find library=/usr/lib/libc.2; required by implicit load
search path=/usr/lib:/usr/local/lob:/dhome1/n/nbkodln/local/lib (SHLIB_PATH)
trying path=/usr/lib/libc.2
/usr/lib/libc.2 => /usr/lib/libc.2
find library=/usr/local/lib/libbz2.sl; required by local/bin/bzip2
search path=/usr/lib:/usr/local/lob:/dhome1/n/nbkodln/local/lib (SHLIB_PATH)
trying path=/usr/lib/libbz2.0
trying path=/usr/local/lob/libbz2.0
trying path=/dhome1/n/nbkodln/local/lib/libbz2.0
trying path=/usr/local/lib/libbz2.0 (absolute)
search path=/usr/lib:/usr/local/lob:/dhome1/n/nbkodln/local/lib (SHLIB_PATH)
trying path=/usr/lib/libbz2.sl
trying path=/usr/local/lob/libbz2.sl
trying path=/dhome1/n/nbkodln/local/lib/libbz2.sl
/usr/local/lib/libbz2.sl => /dhome1/n/nbkodln/local/lib/libbz2.sl
$
Word is that sometimes "+b disable" helps, if the files are not ELF.
This modifies your executbles in place, so it is a best practice to keep a copy of the original!