Redhat 5.5 gcc version 4.1.2
I have a directory call lib, and in that directory I have all the shared libraries (about 30) that we get from our customer as we use their API. We link with this API.
directory structure:
/usr/CSAPI/lib
However, our customer will update their API so we get new libraries, normally about 3 or 4.
What I have been doing is when I get new libraries. Is to remove the old one and put in another directory. And replace them with the new libaries in the lib directory.
/usr/CSAPI/Old_libs
The new and old will have the same name. ie
libcs.so < old
libcs.so < new
Is there a better way to manage this? I was thinking of creating a soft line, but as the names are the same, I am not sure that this will work.
Many thanks,
Usually libraries are versioned, not just "the same name".
You'll have a file in your /usr/lib
directory for each version:
/usr/lib/libFLAC.so.8.2.0
/usr/lib/libFLAC.so.8.2.1
/usr/lib/libFLAC.so.8.2.2
Then you symlink the major library versions to the latest minor version:
/usr/lib/libFLAC.so.8 -> /usr/lib/libFLAC.so.8.2.2
The benefit of this is that API changes will add new files and update the symlinks, but if I need to specify a specific API version number, the file is still right there.
This isn't set in stone, so do whatever works for your release process :)
Symlinks are a very good way to handle this. I would do something slightly differently. I would create a directory structure like:
/usr/CSAPI/lib_v1
/usr/CSAPI/lib_v2
and in each of these I would put the actual files. I would then create a separate directory:
/usr/CSAPI/lib
which only contains symlinks to the actual files in lib_v1
, lib_v2
, etc.
This way lib
has the most current version, but if you need, you can use a previous version by simply changing your LD_LIBRARY_PATH.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.