Operating System - HP-UX
1829712 Members
2530 Online
109992 Solutions
New Discussion

Re: Library Load Error when moved to different box

 
SOLVED
Go to solution
steveo622
Advisor

Library Load Error when moved to different box

Hello,

I am working on an application that is called from JAVA via JNI calls. When I test on my own machine, everything works fine, but as soon as I move the shared libs to another box, the application falls over and complains about missing libraries due to the fact that the libraries that I linked with show up in the messages as hard-coded paths. In the AIX environment I could use a -nolibpath flag on the linker command line that would ignore any paths and look for libraries using the LIBPATH environment variable instead.

Any ideas from anyone out there?

Thanks in advance for your help...

Steve Colbert
4 REPLIES 4
Christopher Caldwell
Honored Contributor

Re: Library Load Error when moved to different box

Use chatr to examine the current library paths and options (can I use SHLIB_PATH; can I not use SHLIB_PATH -- embed the path to libraries; don't embed the path to libraries, etc.)

When chatr shows you what the problem is, use chatr to setup the shared library to fix the problem.

e.g.

chatr +s enable myfile.sl

enables the use of SHLIB_PATH (watch out for the +b setting; the order matters).

man chatr (its a snoozer, but you really need to if you're going to be using it).
steveo622
Advisor

Re: Library Load Error when moved to different box

Thanks for the help.

Is there any way that I can set this switch within the build of the libraries by using some linker or compiler switch?

Thanks,

Steve Colbert
Christopher Caldwell
Honored Contributor
Solution

Re: Library Load Error when moved to different box

Yup. I believe that anything you do with chatr you can do with ld.

The switches for ld are similar (i.e. man ld -see +b, +s).

You can pass the linker switches from the compiler by using -Wx, arglist

-Wx,arglist Pass the comma-separated argument[s] in arglist to
subprocess x. The -W option specification allows
additional, implementation-specific options to be
recognized by the compiler driver. For example,

-Wl,-a,archive

causes the linker to link with archive libraries
instead of with shared libraries. See ld(1) for
details.
steveo622
Advisor

Re: Library Load Error when moved to different box

Thanks Christopher. Your responses were excellent! YOu get a '10'!!!!