General
cancel
Showing results for 
Search instead for 
Did you mean: 

How to force linking to symbolic name of the library?

Adam J Markiewicz
Trusted Contributor

How to force linking to symbolic name of the library?

My question is quite simple:
I have to produce binary that will then run in production on different machine (HPUX 11.11, PA-RISC).
I need to link it with oracle libclntsh.sl.
On my development server I can see that libclntsh.sl is symbolic link to libclntsh.sl.8.0.
After linking (with aCC), I can verify with chatr that it is linked as dynamic /opt/oracle8/product/8.1.7/lib/libclntsh.sl.8.0

In production the binary will be installed on machines with oracle v.8 and v.9. I've verified that the same binary runs correctly with libclntsh.sl.8.0 and libclntsh.sl.9.0, as it does simply things - connect and fetch some data from some tables. So I want that binary to be marked that it should be linked simply with libclntsh.sl. How to do this?

To be honest - I'm quite confused. In so many situations I've noticed that the stored libraries are really symbolic links to some specific versions. I found it really elegant way to have a common api (name of the library that is symbolic link) and the implementation (installed version). But how can this be used, when it is not possible to produce the binary that should link against the name of that link?

If I have on the development server link libclntsh.sl -> libclntsh.sl.8.0 and on the production libclntsh.sl -> libclntsh.sl.9.0 this mechanism is useless. My binary will be able to link only against libclntsh.sl.8.0 anyway, so using those links is only fake.

I hope I described my frustration precisely enough. It is quite likely that this problem is commonly known, but I could not find any good reference besides this
https://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1242387279181+28353475&threadId=82006
although I've tried to search carefully. If so, if I'm trying to invent the wheel again, I'm sorry.

Quite similar problem I have with OpenSSL, where libcrypto.sl leads to libcrypto.sl.0.9.7 on my development server, but can lead to different places in production.

Thanks in advance for help.
Regards
Adam
I do everything perfectly, except from my mistakes
3 REPLIES
Dennis Handly
Acclaimed Contributor

Re: How to force linking to symbolic name of the library?

>I need to link it with oracle libclntsh.sl.

Oracle has implemented SVR4 shlib versioning and that basically says every libclntsh.sl is binary incompatible with any other.
You can't do what you want and is likely not supported.

You of course, could insert symlink trampolines.

>I hope I described my frustration precisely enough.

You need to talk to Oracle to ask their intentions and compatibility statements.

HP-UX has realized that except for using shlib versioning for the great 10.20 to 11.x divide, to maintain forward binary compatibility, you can't really use shlib versioning.
Adam J Markiewicz
Trusted Contributor

Re: How to force linking to symbolic name of the library?

Hello Dennis

Thanks for your support in the first place.
However your answer is pretty depressing, as it is confirming the statement that I've suggested: Using symlinks for the shared libraries is only fake. I only wonder that they are still created at all.
If libclntsh.sl.8.0 is not compatible with libclntsh.sl.9.0 and making them separate is action done on purpose, so why and for what reason those symlinks keep on being created?

Of course inserting symlink trampolines is the most irrational thing that can be done in such situation, because if separation is done for some reason, faking that libclntsh.sl.8.0 is libclntsh.sl.9.0 seems to be even worse than using plain libclntsh.sl name.

BTW - Do you have any knowledge about the situation with OpenSSL and libcrypto.sl?

Thanks anyway.
Regards
Adam
I do everything perfectly, except from my mistakes
Dennis Handly
Acclaimed Contributor

Re: How to force linking to symbolic name of the library?

>Using symlinks for the shared libraries is only fake. I only wonder that they are still created at all.

Shlib versioning allows multiple incompatible versions of the product to co-exist.

It does mean that the vendor must continue to supply older versions of the shlibs along with newer versions, so that existing applications continue to work.

If Oracle does this correctly, it shouldn't matter what version you linked with, as long as you used the oldest version.

>Do you have any knowledge about the situation with OpenSSL and libcrypto.sl?

Sorry, no.