Linking to dcmtk snapshop generates symbolic links

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Markus Sabin
Posts: 73
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Linking to dcmtk snapshop generates symbolic links

#1 Post by Markus Sabin » Wed, 2016-02-17, 15:38

Hi,

I am using the dcmtk-3.6.1_20150924 snapshot on Ubuntu Linux. I am using other libraries as well which are not affected by the problem I am going to describe. All dcmtk shared libraries are affected, I am just using dcmdata here in my description to keep it short.

After

Code: Select all

sudo make install


If find the following files in /usr/local/bin:

Code: Select all

libdcmdata.so -> libdcmdata.so.7
libdcmdata.so.3.6.1
libdcmdata.so.7 -> libdcmdata.so.3.6.1
Regardless to which of these files I instruct gcc to link my application, it always links to libdcmdata.so.7.
Even if I remove all softlinks and link to /usr/lib/libdcmdata.so.3.6.1 explicitly, ldd tells me, that I am still linking to libdcmdata.so.7 and to my surprise by nothing but liniking to libdcmdata.so.3.6.1 this link seems to be implicitly re-created in the file system. I tried to find the clue in the CMake configuration options, but I cannot find anything suspicious.

I suspect this is not a bug but a feature - probably realted to the fact that different snapshots of 3.6.1 can exist. My goal is to ship the dcmtk libraries with my application without having to create softlinks in the installation proccess. Can someone give me an advice please?

Thank you

Markus

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 290
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Linking to dcmtk snapshop generates symbolic links

#2 Post by Jan Schlamelcher » Thu, 2016-02-18, 10:51

Hi Markus,

as far as I know each shared object under linux has its filename and the so called soname. The soname is given when the shared object is created by the linker. CMake seems to use the filename as a base and simply appends the API version counter to it. This seems reasonable, as the API version counter is meant to be incremented whenever the binary interface of the object changes (if we do that whenever this happens is another story), so any version of DCMTK that "implements" API version 7 should be binary compatible to one and another and therefore linking to <filename>.<API_VERSION> should be okay, no matter what actual library version this may then refer to.

So in short: the name is hardwired into the internals of the shared object and will not change no matter how the file is named on the disk. The file will need to be compiled with different parameters for changing it to something else.

I found this for more information about the topic: http://tldp.org/HOWTO/Program-Library-H ... aries.html

Best regards
Jan

Markus Sabin
Posts: 73
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: Linking to dcmtk snapshop generates symbolic links

#3 Post by Markus Sabin » Thu, 2016-02-18, 15:31

Thank you for your response, Jan!

Markus Sabin
Posts: 73
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: Linking to dcmtk snapshop generates symbolic links

#4 Post by Markus Sabin » Thu, 2016-02-25, 13:07

Just a brief follow-up question: Is there a particular reason why the major version in the SONAME (.7) is different from the dcmtk version (.3.6.1). This seems to be somehow unusual, all other libraries that I have come accross so far have a SONAME which is a substring of the full version.

J. Riesmeier
DCMTK Developer
Posts: 2031
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Linking to dcmtk snapshop generates symbolic links

#5 Post by J. Riesmeier » Thu, 2016-02-25, 13:36

The following excerpt is from "dcmtk/CMake/dcmtkPrepare.cmake":

Code: Select all

# Basic version information
# (Starting with version 3.5.5, an odd number at the last position indicates
#  a development snapshot and an even number indicates an official release.)
SET(DCMTK_MAJOR_VERSION 3)
SET(DCMTK_MINOR_VERSION 6)
SET(DCMTK_BUILD_VERSION 1)
# The ABI is not guaranteed to be stable between different snapshots/releases,
# so this particular version number is increased for each snapshot or release.
SET(DCMTK_ABI_VERSION 8)
Does the second comment answer your question?

Markus Sabin
Posts: 73
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

Re: Linking to dcmtk snapshop generates symbolic links

#6 Post by Markus Sabin » Tue, 2016-03-01, 11:14

It does, thank you. I wonder which policy is applied to other libraries which keep the prefix of the version and the ABI version in sync, but that is a different story.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests