Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot locate native library 'libssl.so' #59

Open
shalomb opened this issue Apr 8, 2018 · 10 comments
Open

Cannot locate native library 'libssl.so' #59

shalomb opened this issue Apr 8, 2018 · 10 comments

Comments

@shalomb
Copy link

shalomb commented Apr 8, 2018

I'm not sure if this is a problem with NativeCall or OpenSSL but I get the following error when trying out the examples in the README.

Cannot locate native library 'libssl.so': libssl.so: cannot open shared object file: No such file or directory         

But as far as I can see, I do have libssl.so provided by libssl-dev on debian. What would cause this then?

(ins)13862360000735 gitlab-api - $ cat openssl-test.p6                                                                                                                                                                                                                          
#!/usr/bin/env perl6                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                
use OpenSSL;                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                
my $ssl = OpenSSL.new(:version(3), :client);                                                                                                                                                                                                                                    
my $host = 'google.com';                                                                                                                                                                                                                                                        
my $s = IO::Socket::INET.new(:host, :port(443));                                                                                                                                                                                                                                
$ssl.set-socket($s);                                                                                                                                                                                                                                                            
$ssl.set-connect-state;                                                                                                                                                                                                                                                         
$ssl.connect         
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
(ins)13892390000748 gitlab-api - $ perl6 -e 'use OpenSSL'                                                                                                                                                                                                                       
(ins)13902400000801 gitlab-api - $ perl6 openssl-test.p6                                                                                                                                                                                                                        
Cannot locate native library 'libssl.so': libssl.so: cannot open shared object file: No such file or directory                                                                                                                                                                  
  in method setup at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 289                                                                                                                                                                    
  in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 576                                                                                                                                                                  
  in method new at /home/unop/.perl6/sources/B2CD7D22415C565B8F3970B6E14983C0C9854FF9 (OpenSSL) line 36                                                                                                                                                                         
  in block <unit> at openssl-test.p6 line 5                                                                                                                                                                                                                                      

Environment info.

(ins)1388238127000742 gitlab-api - $ perl6 -v                                                                                                                                                                                                                                   
This is Rakudo version 2018.01 built on MoarVM version 2018.01                                                                                                                                                                                                                  
implementing Perl 6.c.              
                
# zef list --installed | grep -i ssl                                                                                                                                                                                                      
===> Found via /usr/share/perl6/site                                                                                                                                                                                                                                            
===> Found via /usr/share/perl6                                                                                                                                                                                                                                                 
IO::Socket::Async::SSL:ver<0.6.1>                                                                                                                                                                                                                                               
IO::Socket::SSL:ver<0.0.1>:auth<github:sergot>                                                                                                                                                                                                                                  
OpenSSL:ver<0.1.18>:auth<github:sergot>  
                                                                                                                                                                                                                                                                              
(ins)13912411000812 gitlab-api - $ dpkg -l | grep -i libssl                                                                                                                                                                                                                     
ii  libssl-dev:amd64                                               1.1.0f-3+deb9u2                      amd64                                Secure Sockets Layer toolkit - development files                                                                                   
ii  libssl1.0.0:amd64                                              1.0.1t-1+deb8u6                      amd64                                Secure Sockets Layer toolkit - shared libraries                                                                                    
ii  libssl1.0.2:amd64                                              1.0.2n-1                             amd64                                Secure Sockets Layer toolkit - shared libraries                                                                                    
ii  libssl1.1:amd64                                                1.1.0f-3+deb9u2                      amd64                                Secure Sockets Layer toolkit - shared libraries     
                                                                               
(ins)13922420000825 gitlab-api - $ find /usr/ -iname "libssl.so"                                                                                                                                                                                                                
/usr/lib/x86_64-linux-gnu/libssl.so       
                                                                                                                                                                                                                                      
(ins)13932430000853 gitlab-api - $ find /usr/ -iname "libssl.so" -ls                                                                                                                                                                                                            
 34621883      0 lrwxrwxrwx   1 root     root           13 Mar 29 12:51 /usr/lib/x86_64-linux-gnu/libssl.so -> libssl.so.1.1  

(ins)13982480001753 gitlab-api - $ cat /etc/ld.so.conf.d/                                                                                                                                                                                                                       
fakeroot-x86_64-linux-gnu.conf  libc.conf                       x86_64-linux-gnu.conf 
                                                                                                                                                                                          
(ins)13982480001753 gitlab-api - $ cat /etc/ld.so.conf.d/x86_64-linux-gnu.conf                                                                                                                                                                                                  
# Multiarch support                                                                                                                                                                                                                                                             
/usr/local/lib/x86_64-linux-gnu                                                                                                                                                                                                                                                 
/lib/x86_64-linux-gnu                                                                                                                                                                                                                                                           
/usr/lib/x86_64-linux-gnu  
@shalomb
Copy link
Author

shalomb commented Apr 8, 2018

Hmm, On upgrading to rakudo 2018.03 the error changes

unop@d0f805d56931:~/projects/gitlab-api$ cat openssl-test.p6                                                                                                                                                                                                                    
#!/usr/bin/env perl6                                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                                                                
use OpenSSL;                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                
my $ssl = OpenSSL.new(:version(3), :client);                                                                                                                                                                                                                                    
my $host = 'google.com';                                                                                                                                                                                                                                                        
my $s = IO::Socket::INET.new(:host, :port(443));                                                                                                                                                                                                                                
$ssl.set-socket($s);                                                                                                                                                                                                                                                            
$ssl.set-connect-state;                                                                                                                                                                                                                                                         
$ssl.connect                                                                                                                                                                                                                                                                    

unop@d0f805d56931:~/projects/gitlab-api$ perl6 openssl-test.p6                                                                                                                                                                                                                   
Cannot locate symbol 'SSLv3_client_method' in native library 'libssl.so'                                                                                                                                                                                                        
  in method setup at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 290                                                                                                                                                                    
  in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 577                                                                                                                                                                  
  in method new at /usr/share/perl6/site/sources/B2CD7D22415C565B8F3970B6E14983C0C9854FF9 (OpenSSL) line 53                                                                                                                                                                     
  in block <unit> at openssl-test.p6 line 5    

@samcv
Copy link

samcv commented May 16, 2018

@shalomb Can you try installing libssl1.0-dev and see if it fixes your issue? That resolved it for me.

niner added a commit to niner/openssl that referenced this issue Feb 3, 2020
We know that we support OpenSSL 1.1 and 1.0, so rather than hoping that
/usr/lib64/libssl.so points to a supported version, we should try those
first and fall back to the symlink later. This matches the dependency
stated in META6.json more closely.

Fixes GH sergot#16 and sergot#54 and sergot#59
@awgrover
Copy link

Same error. Should raku be more tolerant of versions of the library?

Installing: OpenSSL:ver<0.1.23>:authgithub:sergot
Cannot locate native library 'libssl.so': libssl.so: cannot open shared object file: No such file or directory

Ubuntu 18.04

packages installed: libssl1.0.0, libssl1.1

ldconfig -p | grep libssl.so

libssl.so.1.0.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libssl.so.1.0.0

I note the difference in file name ".so" vs ".so.1.0.0".

This work around fixes it:
ln -s /lib/x86_64-linux-gnu/libssl.so.1.0.0 /lib/x86_64-linux-gnu/libssl.so

@niner
Copy link

niner commented Jun 24, 2020

No, raku shouldn't be more tolerant. Native library's versions are just not optional but have to be specified like I did in niner@407ceac

niner added a commit to niner/openssl that referenced this issue Jun 29, 2020
We know that we support OpenSSL 1.1 and 1.0, so rather than hoping that
/usr/lib64/libssl.so points to a supported version, we should try those
first and fall back to the symlink later. This matches the dependency
stated in META6.json more closely.

Fixes GH sergot#16 and sergot#54 and sergot#59
@Skarsnik
Copy link

This is still an (annoying) issue. Having to install the -dev package of openssl is really bad x)

@sergot
Copy link
Owner

sergot commented Jul 13, 2022

Hi @Skarsnik , as far as I remember I always had to install the libssl-dev for ssl related packages, for example in Python: https://www.pyopenssl.org/en/stable/install.html#supported-openssl-versions .

I am not sure how we can approach this issue to make it more user friendly, I'm open for ideas, thanks in advance!

❤️

@niner
Copy link

niner commented Jul 13, 2022

@sergot the solution is simple and already implemented in: #76

That PR is the correct solution and fixes this issue. It's just a bit outdated, but all the required pieces (e.g. in zef) are now in place.

@melezhik
Copy link

melezhik commented Oct 6, 2022

I have the same issue after building raku-OpenSSL for alpine:

/ # cat openssl-test.raku 
use OpenSSL;

my $host = "ci.sparrowhub.io";

my $ssl = OpenSSL.new(:version(3), :client);
my $s = IO::Socket::INET.new(:$host, :port(443));
$ssl.set-socket($s);
$ssl.set-connect-state;
$ssl.connect
# $ssl.write, etc
/ # raku openssl-test.raku 
Cannot locate symbol 'SSLv3_client_method' in native library 'libssl.so'
  in method setup at /usr/share/rakudo/core/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 319
  in method setup at /usr/share/rakudo/core/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 366
  in sub raku-nativecall at /usr/share/rakudo/core/sources/07D7A4E6581D1C9421412E7D2A0586F9FED3D9B5 (NativeCall::Dispatcher) line 46
  in method new at /usr/share/rakudo/vendor/sources/F83A1D278296155E6CD343A7149423E8E138F165 (OpenSSL) line 53
  in block <unit> at openssl-test.raku line 5

/ # apk info -vv|grep raku-OpenSSL
raku-OpenSSL-0.2.0-r4 - OpenSSL bindings for Raku
/ # apk info -vv|grep ssl
libcrypto1.1-1.1.1q-r0 - Crypto library from openssl
libssl1.1-1.1.1q-r0 - SSL shared libraries
ssl_client-1.35.0-r17 - EXternal ssl_client for busybox wget
openssl-1.1.1q-r0 - toolkit for transport layer security (TLS) - version 1.1
openssl-dev-1.1.1q-r0 - toolkit for transport layer security (TLS) - version 1.1 (development files)

@melezhik
Copy link

melezhik commented Oct 6, 2022

The package descriptor could be found here - https://github.com/melezhik/raku-alpine-repo/blob/main/.tom/packages.raku#L206-L220

@melezhik
Copy link

melezhik commented Oct 6, 2022

the code works just fine after removing "version(3)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants