Unfortuantely such library isn't fount by default by the dlopen (dlopen is used by dyncall library used by moar and nqp):
# cat t.c
#include <dlfcn.h>
#include <stdio.h>
int main (void) {
printf("%p\n", dlopen("libssl.so", RTLD_LAZY));
return 0;
}
# gcc -o t t.c -ldl
# ./t
(nil)
Perl6 example:
$ perl6 --version
This is Rakudo version 2015.12-36-g64a61a3 built on MoarVM version 2015.12
implementing Perl 6.c.
$ cat t
#!/usr/bin/env perl6
use v6;
use NativeCall;
sub SSL_library_init() is native('ssl') { ... }
SSL_library_init();
$ perl6 t
NativeCall: Consider adding the api version of the library you want to use, sub foo is native(ssl, v1)
Cannot locate native library 'libssl.so': libssl.so: cannot open shared object file: No such file or directory
in method setup at /home/ubuntu/.rakudobrew/moar-nom/install/share/perl6/sources/DA0980735978E745E73F676402B9B166FEBF3818 line 230
in method CALL-ME at /home/ubuntu/.rakudobrew/moar-nom/install/share/perl6/sources/DA0980735978E745E73F676402B9B166FEBF3818 line 241
in block <unit> at t line 7
When we pass version along with the library dlopen and NativeCall work properly:
# cat t.c
#include <dlfcn.h>
#include <stdio.h>
int main (void) {
printf("%p\n", dlopen("libssl.so.1.0.0", RTLD_LAZY));
return 0;
}
# gcc -o t t.c -ldl
# ./t
0xe40040
Perl6 example:
$ cat t
#!/usr/bin/env perl6
use v6;
use NativeCall;
sub SSL_library_init() is native('ssl', v1.0.0) { ... }
SSL_library_init();
$ perl6 t
$ echo $?
0
On ubuntu 15.10 by default openssl package pulls in libssl1.0.0 package which contains versioned libssl:
Unfortuantely such library isn't fount by default by the dlopen (dlopen is used by dyncall library used by moar and nqp):
Perl6 example:
When we pass version along with the library dlopen and NativeCall work properly:
Perl6 example:
However unversioned libssl resides in libssl-dev:
I see two distinct reasonable ways to remedy headaches in the future: