Operating System - HP-UX
1828925 Members
2394 Online
109986 Solutions
New Discussion

Re: aCC dynamic shared lib binding

 
SOLVED
Go to solution
Wayne Xin
Occasional Contributor

aCC dynamic shared lib binding

Could someone tell me what options to use to compile a program that depends dynamically on a shared lib?

I have

aCC -o a.out -L. -lmysl xxx.o

when I run a.out from a different directory, it complains that ./libmysl.sl not found, even though libmysl.sl is in my SHLIB_PATH.

I want to put libmysl.sl anywhere and have the SHLIB_PATH include the path. It seems the program (a.out) only looks for the .sl in ./ (current dir).

Thanks.
5 REPLIES 5
Olav Baadsvik
Esteemed Contributor

Re: aCC dynamic shared lib binding


Hi,

To use the SHLIB_PATH environment-variable
your shared lib must be linked with the
+s option.
I have tested this and it works ok.
Se man-page for ld for a description of
the +s option.

Regards
Olav
Steve Steel
Honored Contributor

Re: aCC dynamic shared lib binding

Hi


This is just FYI

Look at

http://atwnt961.external.hp.com/dspp/tech/tech_TechHomePage_IDX/1,1702,,00.html


For a vast amount of useful info.


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Steven Gillard_2
Honored Contributor
Solution

Re: aCC dynamic shared lib binding

You can also use the chatr command to enable SHLIB_PATH lookup on the executable:

$ chatr +s enable a.out

See the chatr man page for more details.

Regards,
Steve
Wayne Xin
Occasional Contributor

Re: aCC dynamic shared lib binding

Thanks guys. My shared lib is a thirdparty lib so I have no control over it. "chatr" seems to work just fine. I wonder if it works for shared lib.
Olav Baadsvik
Esteemed Contributor

Re: aCC dynamic shared lib binding


Hi,

Yes you can use chatr +s enable
on a shared lib. You will see that
you can toggle enabled/disabled on
the line for SHLIB_PATH by using
chatr +s enable library
and
chatr +s disable library

Olav