Operating System - HP-UX
1834178 Members
2510 Online
110064 Solutions
New Discussion

Re: copying executable with shared lib

 
Tore_1
Regular Advisor

copying executable with shared lib

Hi, say I want to copy /usr/sbin/lvdisplay
to /tmp and umount /usr.

chatr lvdisplay says :

lvdisplay:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
shared library list:
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
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
data page size: D (default)
instruction page size: D (default)

How can I change so that /tmp/lvdisplay uses library /tmp/libc.2 instead of /usr/lib/libc.2

Thanks in advance.

12 REPLIES 12
Bill McNAMARA_1
Honored Contributor

Re: copying executable with shared lib

why don't you simply copy the /sbin version?

Later,
Bill
It works for me (tm)
Andreas Voss
Honored Contributor

Re: copying executable with shared lib

Hi,

instead of /usr/sbin
take the files from /sbin.
The /sbin versions uses no shared libs.

Regards
Tore_1
Regular Advisor

Re: copying executable with shared lib

thats not the point
T G Manikandan
Honored Contributor

Re: copying executable with shared lib

The /usr file system cannot be umounted in the multiuser mode.
You have to take the system down to the single user mode.
Lot of processes use /usr when the system is in the multiuser mode.
I used to re-build my application executables to give a different path of the shared library.

Not sure about OS commands.


Thanks
Bill McNAMARA_1
Honored Contributor

Re: copying executable with shared lib

no, but it's a solution ;)

Use ld

Later,
Bill
It works for me (tm)
Clemens van Everdingen
Honored Contributor

Re: copying executable with shared lib

Hi,

What is the point ?

I would have suggested to boot in lvm maintenance mode.

C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Tore_1
Regular Advisor

Re: copying executable with shared lib

the point is how to change the library list in an executable
Tore_1
Regular Advisor

Re: copying executable with shared lib

TG : how do I do that (remember I only got the exe + libray, not the object file)?

T G Manikandan
Honored Contributor

Re: copying executable with shared lib

rebuild the executables with the path specified as /tmp/lib....


Deepak Extross
Honored Contributor

Re: copying executable with shared lib

Try enabling the use of SHLIB_PATH.
#chatr +s enable lvdisplay
#export SHLIB_PATH=${SHLIB_PATH}:/tmp
Tore_1
Regular Advisor

Re: copying executable with shared lib

De.. I tried this (-s), but lvdisplay still uses /usr/lib/libc.2 (I ran it through tusc which showed that it open /usr/lib/libc.2)
Mike Stroyan
Honored Contributor

Re: copying executable with shared lib

chatr +s and SHLIB_PATH work for me-

% cp /usr/sbin/lvdisplay .
% chmod +w lvdisplay
% chatr -s +s enable lvdisplay
% cp /usr/lib/libc.2 .
% SHLIB_PATH=. tusc -s open lvdisplay
tusc: lvdisplay: No such file or directory
% SHLIB_PATH=. tusc -s open ./lvdisplay
open("/usr/lib/dld.sl", O_RDONLY, 05364) ................. = 3
open("/opt/graphics/OpenGL/lib/libogltls.sl", O_RDONLY, 0) = 3
open("./libc.2", O_RDONLY, 02) ........................... = 3
open("/usr/lib/libdld.2", O_RDONLY, 046437) .............. = 3
open("./libc.2", O_RDONLY, 03) ........................... = 3
open("/usr/lib/nls/loc/locales.2/en_US.iso88591", O_RDONLY, 0) = 3
open("/usr/lib/nls/en/US/iso88591/locale.inf", O_RDONLY, 0) ERR#2 ENOENT
open("/usr/lib/nls/american/iso88591/locale.inf", O_RDONLY, 056) ERR#2 ENOENT
open("/usr/lib/nls/msg/en_US.iso88591/lvm.cat", O_RDONLY, 0177777) ERR#2 ENOENT
open("/usr/lib/nls/en/US/iso88591/lvm.cat", O_RDONLY, 0177777) ERR#2 ENOENT
Usage: lvdisplay
[-v]
[-k]
LogicalVolumePath...
More arguments required.
%

You may need to use "chatr -l library" if some of the libraries have static instead of dynamic paths. You will also have issues if some shared libraries depend on other shared libraries using paths that you don't like.