Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7680 Discussions

icpc incorrectly links to symbolic linked library on linux

TRUONG__PHONG
Novice
294 Views

We are using icpc to dynamically link to an oracle library as follows (in suse linux 11.4)

icpc -shared -m64 -static-intel  -Wl,--version-script .... (object list) ... -L/home/oracle/app/oracle/product/12.1.0/dbhome_1/lib -lclntsh

In the directory /home/oracle/app/oracle/product/12.1.0/dbhome_1/lib, we have the symbolic link:

lrwxrwxrwx 1 oracle oinstall    69 May 8 2017 libclntsh.so -> /home/oracle/app/oracle/product/12.1.0/dbhome_1/lib/libclntsh.so.12.1

 

We assume that this link will produce a library which will dependant on libclntsh.so .  But the resulted library is dependent on libclntsh.so.12.1, which is the symolic linked library. This causes our library not to be version in dependent.

Please advise.

Thanks in advanced

0 Kudos
1 Solution
TRUONG__PHONG
Novice
294 Views

Hi,

The ldd shows a dependency on libclntsh.so.12.1.    I did some more research.  This is the problem with Oracle library.   There are 2 ways to ship a library that support older version linking:

a/ make sure when you create the library , the SONAME is non version (objdump -x lib.so | grep SONAME).    The SONAME of the library will be used to stored the dependency when another shared library is built using your lib.  Thus Mutilple version of a shared lirary can have the same SONAME, allowing a shared library to be backward compatible.

 

b/ Or you use the same name with the version as the SONAME (default) .  In this case libclntsh.so.12.1.  However, you product when installed need to make a link to from this to the latest library that you ship (libclntsh.so.18.1)  to allow backward compatible.

Oracle chose the approach b/, but the install has problem creating the link to the old version causing my problem.

With this, I will close this question. Thx

View solution in original post

2 Replies
Viet_H_Intel
Moderator
294 Views

What ldd on this library print?

TRUONG__PHONG
Novice
295 Views

Hi,

The ldd shows a dependency on libclntsh.so.12.1.    I did some more research.  This is the problem with Oracle library.   There are 2 ways to ship a library that support older version linking:

a/ make sure when you create the library , the SONAME is non version (objdump -x lib.so | grep SONAME).    The SONAME of the library will be used to stored the dependency when another shared library is built using your lib.  Thus Mutilple version of a shared lirary can have the same SONAME, allowing a shared library to be backward compatible.

 

b/ Or you use the same name with the version as the SONAME (default) .  In this case libclntsh.so.12.1.  However, you product when installed need to make a link to from this to the latest library that you ship (libclntsh.so.18.1)  to allow backward compatible.

Oracle chose the approach b/, but the install has problem creating the link to the old version causing my problem.

With this, I will close this question. Thx

Reply