1833707 Members
2489 Online
110063 Solutions
New Discussion

shared lib path error

 
SOLVED
Go to solution
Edmund Brown
Occasional Advisor

shared lib path error

Hi Everyone

I have an installer which is dependant on several shared libraries. These libraries are specified with a full path name at link time and I am attempting to use chatr to remove this path dependency.

chatr +s enable +b disable –l -l

When I do an ldd on the installer on the destination machine (with libraries unpacked into the install directory) I see a Can’t open shared library: error followed by the original full library path.

Have I got a syntactical error in my chatr command or does my problem lie elsewhere.

Thanks in advance
Ed
4 REPLIES 4
Steven E. Protter
Exalted Contributor
Solution

Re: shared lib path error

Shalom Ed,

Check the SHLIB_PATH when running the above commands. Make sure it includes paths to the relavent libraries in the correct order to avoid name conflict.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Edmund Brown
Occasional Advisor

Re: shared lib path error

Hi Steven

Thanks for the advice but I am not sure I fully understand. The SHLIB_PATH is not set before the chatr call during the build on the development machine or before the ldd call on the destination machine.

As the libraries in question are unpacked into the installer directory I tried setting the SHLIB_PATH to this path before running the ldd command but saw the same error showing the library still qualified with the full path from the development machine.

Can I clarify that my aim in using the chatr command is to strip the path from the static library in question during the link so that it can just be dumped into the install directory on the destination machine.

Thanks again
Ed
Dennis Handly
Acclaimed Contributor

Re: shared lib path error

>specified with a full path name at link time

Why? Why not use -L and -l to point to them?

>chatr +s enable +b disable -l -l

Why wouldn't you do this before you package it?

Also using -l isn't apt to do anything unless you used +l, or didn't use -lfoo when you linked. (I guess that's what you said by "full path name" above.)

>my aim in using the chatr command is to strip the path from the static library in question during the link so that it can just be dumped into the install directory on the destination machine.

Using +s enable with -l should do that.
$ chatr ...
$ export SHLIB_PATH=...
$ ldd ...

What did chatr(1) give when you did the above command?
Edmund Brown
Occasional Advisor

Re: shared lib path error

Hi Guys

Thanks for the suggestions however as usual my problem was in missing the obvious. It appears that the chatr command was doing its jobs perfectly in stripping the library path, run in a script straight after linking as below

chatr +s enable +b disable -l -l

Unfortunately the second library path I had given it didn't exist and so the command failed with a nice verbal error message which I gobbled up later in my script using a grep.

Fixed this and the chatr output on my problem exe changes from this...

HP-C8000 37% chatr install
install:
shared executable
shared library dynamic path search:
SHLIB_PATH disabled second
embedded path disabled first Not Defined
shared library list:
static /sources/my_lib.so
...

...to this ...

HP-C8000 45% chatr install
install:
shared executable
shared library dynamic path search:
SHLIB_PATH enabled first
embedded path disabled second Not Defined
shared library list:
dynamic /sources/mylib.so
...

Thanks again for the help

Ed