Operating System - HP-UX
1833876 Members
1849 Online
110063 Solutions
New Discussion

Re: Difficulty with shared objects

 
Fred Vogel
Frequent Advisor

Difficulty with shared objects

Hello,

I have used these forums for a while for help on a number of HP-UX related issues; this is my first time to actually post. I'm a relative newcomer to HP-UX.

System: IA64 B39010B running 11.23i (v2)
Compiler: aCC/cc A.06.13

I am building a piece of software that integrates with OV8 & NNM 7.51.

The executables and custom .so's build without problem. The executables run. However, when I trace the problem, shl_load or dlopen (i've used both) tell me it can't find the library.

I compiled with +s, and had SHLIB_PATH and LD_LIBRARY_PATH populated with the path to the library. I have verified that there are no typo's. Chatr tells me that it will used LD_LIBRARY_PATH as its primary, and SHLIB_PATH as its seconday source for searching for .so's for the executable.

The exe actually takes the library name as a parameter, and i have put the full path in with the name.

What am i doing wrong?

If you need more info, let me know and I will post it.

Thank you in advance,

Fred
9 REPLIES 9
Hein van den Heuvel
Honored Contributor

Re: Difficulty with shared objects


Hello Fred,

I'm afraid I have little or nothing of value to add to the question itself but I just wanted to compliment you on an exemplary post. Very refreshing!

All the details which seem relevant yet not too much. Not just one-line, man-page question, nor a book. Rigth in the middle.
And great attitude:
- Not assuming the system is broken.
- Assuming you need to provide more details.
Thank you.

As for the problem, I was going to suggest trace or truss, but you already did that.

How about using ldd on all images in the chain? Maybe the primary image can be found (is allowed to be found!) but the secondary image which it relies on has a problem?!

My swag for the underlying issue is protection/permission, as you already hint also. Those -s mode bits ?!

Regards,
Hein van den Heuvel




Dennis Handly
Acclaimed Contributor

Re: Difficulty with shared objects

>shl_load or dlopen tell me it can't find the library. I compiled with +s, and had SHLIB_PATH ...

shl_load will not look at SHLIB_PATH or LD_LIBRARY_PATH unless you OR in DYNAMIC_PATH. I'm not sure about dlopen.

>The exe actually takes the library name as a parameter, and i have put the full path in with the name.

If you pass the full path, then my comment above isn't the issue.

You may want to export LD_LIBRARY_PATH then invoke ldd on your shared lib.

>Hein: I just wanted to compliment you on an exemplary post.

The only problem is the subject. These are shared libs not shared objects on HP-UX. ;-)

>Hein: I was going to suggest trace or truss, but you already did that.

I see no evidence of the use of tusc??

You may want to use tusc on that ldd I mention above. That would show you all of the opens it is doing to find your shlib.

Note: +s is not honored for SUID applications.
Fred Vogel
Frequent Advisor

Re: Difficulty with shared objects

Thank you both for responding. Sorry for the delay in response.

As I mentioned I'm fairly new to working in the HP-UX environment. As such there are a lot of tools I don't know about.

For example, I had never heard of tusc. I also had not known to use the -r option for LDD.

As a result of this, I have been able to find problems and fix them.

I am still having a problem buiding one library. It says there are like 400+ unsat symbols. Most of these are things that would be define in headers, like _getrlimit64 and __thread_getspecific.

I do not understand why these are not being picked up. Can you assist with this problem?

Thanks
Fred
Fred Vogel
Frequent Advisor

Re: Difficulty with shared objects

Also, forgot to ask; what are +s bits?

I would like to clarify what I meant by trace in my first post. I crawled throuh it on the WDB.

Thank you once again.

Fred
Dennis Handly
Acclaimed Contributor

Re: Difficulty with shared objects

>I am still having a problem buiding one library. It says there are like 400+ unsat symbols. Most of these are things that would be define in headers, like _getrlimit64 and __thread_getspecific.

You ignore those and assume they are defined in libc and libpthread.

>I do not understand why these are not being picked up.

Typically shared libs don't need dependent libs if the executable has them already. In particular you should never add -lc to a shared lib. If you add it, then use ldd -r, and nothing is left, you're fine. Then you can then remove -lc.

>what are +s bits?

When you link with +s, you tell dld it can can look at SHLIB_PATH to find runtime libs.

You haven't assigned any points yet. Please read:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
Fred Vogel
Frequent Advisor

Re: Difficulty with shared objects

Fair enough, I have read the guidelines and assigned points. I have been too busy today to follow-up on your last suggestion. I'm pretty sure I know what is going to happen; but when I run it I will post what it says rather than what I think it is going to say.

Thanks!!

Fred
Dennis Handly
Acclaimed Contributor

Re: Difficulty with shared objects

>read the guidelines and assigned points

I don't see any evidence of that??

>what are +s bits?

Ah, Hein said: Those -s mode bits?
He may be talking about SUID bits? These cause the SHLIB_PATH to be ignored, as a security feature.
Fred Vogel
Frequent Advisor

Re: Difficulty with shared objects

Ok...i didn't see the submit points button and they did not get submitted. Thank you for your help. I'm going to close this thread and then create a new thread with a more specific question, when i figure out what that will be.
Fred Vogel
Frequent Advisor

Re: Difficulty with shared objects

Per previous response