Operating System - HP-UX
1829590 Members
6217 Online
109992 Solutions
New Discussion

Directory Path listing of .sl in ldd

 
Vibhor Kumar Agarwal
Esteemed Contributor

Directory Path listing of .sl in ldd

Hello,

When doing ldd file.sl,
I am getting full path names of shared libs.
Eg.
a.sl -> /A/x.sl
b.sl -> /A/B/y.sl

Now the problem that I am facing is that:
There are 3 variable paths from where a .sl searches shared libs during runtime
SH_LIBPATH, LD_LIBRARY_PATH and Embedded Path (which contains the above eg. path )

Now during runtime it will search the shared libs in the following order
Embedded Path -> LD_LIBRARY_PATH -> SH_LIBPATH

So if i change my build location shared libs for some unit testing, then central testing will give abnormal results as it will start referencing these libs.

I have tried to disable path using
chatr +b disable
and
chatr +s disable

It gives me warning Embedded paths can't be disabled in an ELF file, and it disables the LD and SH ones.

So what should I do to overcome this.
Vibhor Kumar Agarwal
6 REPLIES 6
Ermin Borovac
Honored Contributor

Re: Directory Path listing of .sl in ldd

You can do

$ chatr +s enable file.sl

to change the search order to

LD_LIBRARY_PATH first
SHLIB_PATH second
embedded path third

Is that what you were looking for or am I a way off?
ranganath ramachandra
Esteemed Contributor

Re: Directory Path listing of .sl in ldd

i am not sure i understand exactly what the problem is. if you do not want any embedded path (RPATH in elf lingo?), you can use the "+nodefaultrpath" linker option.

but i think the proper way to handle this is to set LD_LIBRARY_PATH appropriately in the different environments.

if you turn off all paths, where do you want the program to pick up libraries from ? the system libraries path (/usr/lib/...)?
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo

Vibhor Kumar Agarwal
Esteemed Contributor

Re: Directory Path listing of .sl in ldd

Phew,

All confused.

That day i had tried all the options including chatr +s enable file.sl and nothing worked.

Today by itself its showing the different order.

LD_LIBRARY_PATH -> SH_LIBPATH -> EmbeddedPath

+nodefaultrpath option worked out.
But what is it doing exactly, i think its not letting the .sl to search for that shared lib during runtime or something else.
Vibhor Kumar Agarwal
ranganath ramachandra
Esteemed Contributor

Re: Directory Path listing of .sl in ldd

+nodefaultrpath prevents the recording of link-time LPATH (typically /usr/lib/pa20_64:/opt/langtools/lib/pa20_64, set by compiler) as RPATH (embedded path).
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo

Vibhor Kumar Agarwal
Esteemed Contributor

Re: Directory Path listing of .sl in ldd

Thanks,

Can you help me in finding out what did i do wrong on the first occasion,
as it showed different order of all the 3 paths and i couldn't change them,

next time onwards its giving a different order. should i use +nodefaultrpath in my linking.
will there be any side effets?
Vibhor Kumar Agarwal
ranganath ramachandra
Esteemed Contributor

Re: Directory Path listing of .sl in ldd

"chatr +s enable +b enable " should set the order such that environment variable lookup is first in the order before embedded path. you can also pass '+s' and '+b' (in this order) to the linker (as -Wl,+s,+b through compiler). if you dont want any embedded path, you can use "+nodefaultrpath".
 
--
ranga
hp-ux 11i v3[i work for hpe]

Accept or Kudo