Finding libssl on a customer's Linux

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












We're using a library which needs to load libssl in a version 1.0.*. It doesn't work with libssl.so.1.1. We need it to work on any Linux system.



We try to load various versions and this usually works, but on system of one customer there's just the following:



/usr/lib64/libssl.so.1.1.0g
/usr/lib64/libssl.so.10
/usr/lib64/libssl.so.1.0.2m
/usr/lib64/libssl.so.1.1


We're trying to load libssl.so.1.0 and libssl.so.1.0.2, but it doesn't find libssl.so.1.0.2m because of the trailing "m".



I wonder what's the naming scheme of libssl, if any?



Do we really need to provide our own version or is there a better way?



Should we loop from libssl.so.1.0.2z down to libssl.so.1.0.2a? Should we scan the library path manually?







share|improve this question






















  • ln -s /usr/lib64/libssl.so.1.0.2m /usr/lib64/libssl.so.1.0.2 might work.
    – Rui F Ribeiro
    Feb 1 at 9:32











  • @RuiFRibeiro There are two problems with it: 1. Knowing the exact name. 2. It's a customer's computer.
    – maaartinus
    Feb 1 at 9:37






  • 1




    The bigger problem might be not having a test system then. Test the ln, is harmless and can be removed easily. See also @mjturner answer, it recalls important details.
    – Rui F Ribeiro
    Feb 1 at 9:38







  • 2




    How are you distributing your library? Don't try to find a compatible copy of OpenSSL on someone else's computer that you have no control over - bring the copy with you. The most reliable way is to distribute a known-compatible copy of the necessary OpenSSL libraries with your own library. Put the OpenSSL shared object(s) in the same directory as your library then find and dlopen() it, or statically link OpenSSL and build your shared object(s) so they incorporate the OpenSSL object files from the OpenSSL static libraries.
    – Andrew Henle
    Feb 1 at 10:38















up vote
1
down vote

favorite












We're using a library which needs to load libssl in a version 1.0.*. It doesn't work with libssl.so.1.1. We need it to work on any Linux system.



We try to load various versions and this usually works, but on system of one customer there's just the following:



/usr/lib64/libssl.so.1.1.0g
/usr/lib64/libssl.so.10
/usr/lib64/libssl.so.1.0.2m
/usr/lib64/libssl.so.1.1


We're trying to load libssl.so.1.0 and libssl.so.1.0.2, but it doesn't find libssl.so.1.0.2m because of the trailing "m".



I wonder what's the naming scheme of libssl, if any?



Do we really need to provide our own version or is there a better way?



Should we loop from libssl.so.1.0.2z down to libssl.so.1.0.2a? Should we scan the library path manually?







share|improve this question






















  • ln -s /usr/lib64/libssl.so.1.0.2m /usr/lib64/libssl.so.1.0.2 might work.
    – Rui F Ribeiro
    Feb 1 at 9:32











  • @RuiFRibeiro There are two problems with it: 1. Knowing the exact name. 2. It's a customer's computer.
    – maaartinus
    Feb 1 at 9:37






  • 1




    The bigger problem might be not having a test system then. Test the ln, is harmless and can be removed easily. See also @mjturner answer, it recalls important details.
    – Rui F Ribeiro
    Feb 1 at 9:38







  • 2




    How are you distributing your library? Don't try to find a compatible copy of OpenSSL on someone else's computer that you have no control over - bring the copy with you. The most reliable way is to distribute a known-compatible copy of the necessary OpenSSL libraries with your own library. Put the OpenSSL shared object(s) in the same directory as your library then find and dlopen() it, or statically link OpenSSL and build your shared object(s) so they incorporate the OpenSSL object files from the OpenSSL static libraries.
    – Andrew Henle
    Feb 1 at 10:38













up vote
1
down vote

favorite









up vote
1
down vote

favorite











We're using a library which needs to load libssl in a version 1.0.*. It doesn't work with libssl.so.1.1. We need it to work on any Linux system.



We try to load various versions and this usually works, but on system of one customer there's just the following:



/usr/lib64/libssl.so.1.1.0g
/usr/lib64/libssl.so.10
/usr/lib64/libssl.so.1.0.2m
/usr/lib64/libssl.so.1.1


We're trying to load libssl.so.1.0 and libssl.so.1.0.2, but it doesn't find libssl.so.1.0.2m because of the trailing "m".



I wonder what's the naming scheme of libssl, if any?



Do we really need to provide our own version or is there a better way?



Should we loop from libssl.so.1.0.2z down to libssl.so.1.0.2a? Should we scan the library path manually?







share|improve this question














We're using a library which needs to load libssl in a version 1.0.*. It doesn't work with libssl.so.1.1. We need it to work on any Linux system.



We try to load various versions and this usually works, but on system of one customer there's just the following:



/usr/lib64/libssl.so.1.1.0g
/usr/lib64/libssl.so.10
/usr/lib64/libssl.so.1.0.2m
/usr/lib64/libssl.so.1.1


We're trying to load libssl.so.1.0 and libssl.so.1.0.2, but it doesn't find libssl.so.1.0.2m because of the trailing "m".



I wonder what's the naming scheme of libssl, if any?



Do we really need to provide our own version or is there a better way?



Should we loop from libssl.so.1.0.2z down to libssl.so.1.0.2a? Should we scan the library path manually?









share|improve this question













share|improve this question




share|improve this question








edited Feb 1 at 10:04









Kusalananda

103k13202318




103k13202318










asked Feb 1 at 8:52









maaartinus

1,62052022




1,62052022











  • ln -s /usr/lib64/libssl.so.1.0.2m /usr/lib64/libssl.so.1.0.2 might work.
    – Rui F Ribeiro
    Feb 1 at 9:32











  • @RuiFRibeiro There are two problems with it: 1. Knowing the exact name. 2. It's a customer's computer.
    – maaartinus
    Feb 1 at 9:37






  • 1




    The bigger problem might be not having a test system then. Test the ln, is harmless and can be removed easily. See also @mjturner answer, it recalls important details.
    – Rui F Ribeiro
    Feb 1 at 9:38







  • 2




    How are you distributing your library? Don't try to find a compatible copy of OpenSSL on someone else's computer that you have no control over - bring the copy with you. The most reliable way is to distribute a known-compatible copy of the necessary OpenSSL libraries with your own library. Put the OpenSSL shared object(s) in the same directory as your library then find and dlopen() it, or statically link OpenSSL and build your shared object(s) so they incorporate the OpenSSL object files from the OpenSSL static libraries.
    – Andrew Henle
    Feb 1 at 10:38

















  • ln -s /usr/lib64/libssl.so.1.0.2m /usr/lib64/libssl.so.1.0.2 might work.
    – Rui F Ribeiro
    Feb 1 at 9:32











  • @RuiFRibeiro There are two problems with it: 1. Knowing the exact name. 2. It's a customer's computer.
    – maaartinus
    Feb 1 at 9:37






  • 1




    The bigger problem might be not having a test system then. Test the ln, is harmless and can be removed easily. See also @mjturner answer, it recalls important details.
    – Rui F Ribeiro
    Feb 1 at 9:38







  • 2




    How are you distributing your library? Don't try to find a compatible copy of OpenSSL on someone else's computer that you have no control over - bring the copy with you. The most reliable way is to distribute a known-compatible copy of the necessary OpenSSL libraries with your own library. Put the OpenSSL shared object(s) in the same directory as your library then find and dlopen() it, or statically link OpenSSL and build your shared object(s) so they incorporate the OpenSSL object files from the OpenSSL static libraries.
    – Andrew Henle
    Feb 1 at 10:38
















ln -s /usr/lib64/libssl.so.1.0.2m /usr/lib64/libssl.so.1.0.2 might work.
– Rui F Ribeiro
Feb 1 at 9:32





ln -s /usr/lib64/libssl.so.1.0.2m /usr/lib64/libssl.so.1.0.2 might work.
– Rui F Ribeiro
Feb 1 at 9:32













@RuiFRibeiro There are two problems with it: 1. Knowing the exact name. 2. It's a customer's computer.
– maaartinus
Feb 1 at 9:37




@RuiFRibeiro There are two problems with it: 1. Knowing the exact name. 2. It's a customer's computer.
– maaartinus
Feb 1 at 9:37




1




1




The bigger problem might be not having a test system then. Test the ln, is harmless and can be removed easily. See also @mjturner answer, it recalls important details.
– Rui F Ribeiro
Feb 1 at 9:38





The bigger problem might be not having a test system then. Test the ln, is harmless and can be removed easily. See also @mjturner answer, it recalls important details.
– Rui F Ribeiro
Feb 1 at 9:38





2




2




How are you distributing your library? Don't try to find a compatible copy of OpenSSL on someone else's computer that you have no control over - bring the copy with you. The most reliable way is to distribute a known-compatible copy of the necessary OpenSSL libraries with your own library. Put the OpenSSL shared object(s) in the same directory as your library then find and dlopen() it, or statically link OpenSSL and build your shared object(s) so they incorporate the OpenSSL object files from the OpenSSL static libraries.
– Andrew Henle
Feb 1 at 10:38





How are you distributing your library? Don't try to find a compatible copy of OpenSSL on someone else's computer that you have no control over - bring the copy with you. The most reliable way is to distribute a known-compatible copy of the necessary OpenSSL libraries with your own library. Put the OpenSSL shared object(s) in the same directory as your library then find and dlopen() it, or statically link OpenSSL and build your shared object(s) so they incorporate the OpenSSL object files from the OpenSSL static libraries.
– Andrew Henle
Feb 1 at 10:38











1 Answer
1






active

oldest

votes

















up vote
2
down vote



accepted










I'm not sure how you're opening libssl - I assume dlopen()?



Searching a hard-coded list of directory paths for a library sounds rather fragile - you'd be better off letting the dynamic linker do the work for you. Perhaps parsing the output of ldconfig -p is worth trying? On a Debian system, I see the following:



$ ldconfig -p|grep ssl
libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl.so.1.0.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2


On a RHEL 7.4 system:



$ ldconfig -p|grep ssl
libssl3.so (libc6,x86-64) => /lib64/libssl3.so
libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10


Note that on the Debian system the library is in /usr/lib/x86_64-linux-gnu, whereas on the RHEL system it's in /lib64 (also note the widely varying library names). Unless you use something like the output of ldconfig, you're going to have to search all of those distribution-specific paths yourself if you plan to "work on any Linux system". Admittedly, the directory paths are listed in /etc/ld.so.conf but I think using ldconfig is probably still easier.






share|improve this answer






















  • I think the OP is not in Debian. +1
    – Rui F Ribeiro
    Feb 1 at 9:37











  • @RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
    – maaartinus
    Feb 1 at 9:41










  • I agree, that is why I voted you up.
    – Rui F Ribeiro
    Feb 1 at 9:44






  • 1




    @RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
    – mjturner
    Feb 1 at 9:57











  • You understand I just commented it was not Debian, right?
    – Rui F Ribeiro
    Feb 1 at 10:13










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f421153%2ffinding-libssl-on-a-customers-linux%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
2
down vote



accepted










I'm not sure how you're opening libssl - I assume dlopen()?



Searching a hard-coded list of directory paths for a library sounds rather fragile - you'd be better off letting the dynamic linker do the work for you. Perhaps parsing the output of ldconfig -p is worth trying? On a Debian system, I see the following:



$ ldconfig -p|grep ssl
libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl.so.1.0.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2


On a RHEL 7.4 system:



$ ldconfig -p|grep ssl
libssl3.so (libc6,x86-64) => /lib64/libssl3.so
libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10


Note that on the Debian system the library is in /usr/lib/x86_64-linux-gnu, whereas on the RHEL system it's in /lib64 (also note the widely varying library names). Unless you use something like the output of ldconfig, you're going to have to search all of those distribution-specific paths yourself if you plan to "work on any Linux system". Admittedly, the directory paths are listed in /etc/ld.so.conf but I think using ldconfig is probably still easier.






share|improve this answer






















  • I think the OP is not in Debian. +1
    – Rui F Ribeiro
    Feb 1 at 9:37











  • @RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
    – maaartinus
    Feb 1 at 9:41










  • I agree, that is why I voted you up.
    – Rui F Ribeiro
    Feb 1 at 9:44






  • 1




    @RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
    – mjturner
    Feb 1 at 9:57











  • You understand I just commented it was not Debian, right?
    – Rui F Ribeiro
    Feb 1 at 10:13














up vote
2
down vote



accepted










I'm not sure how you're opening libssl - I assume dlopen()?



Searching a hard-coded list of directory paths for a library sounds rather fragile - you'd be better off letting the dynamic linker do the work for you. Perhaps parsing the output of ldconfig -p is worth trying? On a Debian system, I see the following:



$ ldconfig -p|grep ssl
libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl.so.1.0.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2


On a RHEL 7.4 system:



$ ldconfig -p|grep ssl
libssl3.so (libc6,x86-64) => /lib64/libssl3.so
libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10


Note that on the Debian system the library is in /usr/lib/x86_64-linux-gnu, whereas on the RHEL system it's in /lib64 (also note the widely varying library names). Unless you use something like the output of ldconfig, you're going to have to search all of those distribution-specific paths yourself if you plan to "work on any Linux system". Admittedly, the directory paths are listed in /etc/ld.so.conf but I think using ldconfig is probably still easier.






share|improve this answer






















  • I think the OP is not in Debian. +1
    – Rui F Ribeiro
    Feb 1 at 9:37











  • @RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
    – maaartinus
    Feb 1 at 9:41










  • I agree, that is why I voted you up.
    – Rui F Ribeiro
    Feb 1 at 9:44






  • 1




    @RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
    – mjturner
    Feb 1 at 9:57











  • You understand I just commented it was not Debian, right?
    – Rui F Ribeiro
    Feb 1 at 10:13












up vote
2
down vote



accepted







up vote
2
down vote



accepted






I'm not sure how you're opening libssl - I assume dlopen()?



Searching a hard-coded list of directory paths for a library sounds rather fragile - you'd be better off letting the dynamic linker do the work for you. Perhaps parsing the output of ldconfig -p is worth trying? On a Debian system, I see the following:



$ ldconfig -p|grep ssl
libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl.so.1.0.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2


On a RHEL 7.4 system:



$ ldconfig -p|grep ssl
libssl3.so (libc6,x86-64) => /lib64/libssl3.so
libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10


Note that on the Debian system the library is in /usr/lib/x86_64-linux-gnu, whereas on the RHEL system it's in /lib64 (also note the widely varying library names). Unless you use something like the output of ldconfig, you're going to have to search all of those distribution-specific paths yourself if you plan to "work on any Linux system". Admittedly, the directory paths are listed in /etc/ld.so.conf but I think using ldconfig is probably still easier.






share|improve this answer














I'm not sure how you're opening libssl - I assume dlopen()?



Searching a hard-coded list of directory paths for a library sounds rather fragile - you'd be better off letting the dynamic linker do the work for you. Perhaps parsing the output of ldconfig -p is worth trying? On a Debian system, I see the following:



$ ldconfig -p|grep ssl
libssl.so.1.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.1
libssl.so.1.0.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libssl.so.1.0.2


On a RHEL 7.4 system:



$ ldconfig -p|grep ssl
libssl3.so (libc6,x86-64) => /lib64/libssl3.so
libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10


Note that on the Debian system the library is in /usr/lib/x86_64-linux-gnu, whereas on the RHEL system it's in /lib64 (also note the widely varying library names). Unless you use something like the output of ldconfig, you're going to have to search all of those distribution-specific paths yourself if you plan to "work on any Linux system". Admittedly, the directory paths are listed in /etc/ld.so.conf but I think using ldconfig is probably still easier.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 1 at 10:00

























answered Feb 1 at 9:35









mjturner

3,8681224




3,8681224











  • I think the OP is not in Debian. +1
    – Rui F Ribeiro
    Feb 1 at 9:37











  • @RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
    – maaartinus
    Feb 1 at 9:41










  • I agree, that is why I voted you up.
    – Rui F Ribeiro
    Feb 1 at 9:44






  • 1




    @RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
    – mjturner
    Feb 1 at 9:57











  • You understand I just commented it was not Debian, right?
    – Rui F Ribeiro
    Feb 1 at 10:13
















  • I think the OP is not in Debian. +1
    – Rui F Ribeiro
    Feb 1 at 9:37











  • @RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
    – maaartinus
    Feb 1 at 9:41










  • I agree, that is why I voted you up.
    – Rui F Ribeiro
    Feb 1 at 9:44






  • 1




    @RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
    – mjturner
    Feb 1 at 9:57











  • You understand I just commented it was not Debian, right?
    – Rui F Ribeiro
    Feb 1 at 10:13















I think the OP is not in Debian. +1
– Rui F Ribeiro
Feb 1 at 9:37





I think the OP is not in Debian. +1
– Rui F Ribeiro
Feb 1 at 9:37













@RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
– maaartinus
Feb 1 at 9:41




@RuiFRibeiro I was told, the problematic system is Fedora; anyway we need a solution for any Linux desktop . But ldconfig and/or /etc/ld.so.conf may be portable enough.
– maaartinus
Feb 1 at 9:41












I agree, that is why I voted you up.
– Rui F Ribeiro
Feb 1 at 9:44




I agree, that is why I voted you up.
– Rui F Ribeiro
Feb 1 at 9:44




1




1




@RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
– mjturner
Feb 1 at 9:57





@RuiFRibeiro Indeed, but the same solution should apply. ldconfig -p should work on any Linux system (I've just confirmed and added some detail).
– mjturner
Feb 1 at 9:57













You understand I just commented it was not Debian, right?
– Rui F Ribeiro
Feb 1 at 10:13




You understand I just commented it was not Debian, right?
– Rui F Ribeiro
Feb 1 at 10:13












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f421153%2ffinding-libssl-on-a-customers-linux%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?