I am trying to call cumulative distribution function of chisq function in GSL from raku.
This is my raku script chisq.raku
#Calling gsl_cdf_chisq-P function in GSL from raku
use NativeCall;
sub gsl_cdf_chisq_P(num64, num64) returns num64 is native('gsl') { * };
sub gsl_cdf_chisq_Q(num64, num64) returns num64 is native('gsl') { * };
sub pchisq($q, $df, $lower-tail = True) {
my $a = $q.Num;
my $b = $df.Num;
if $lower-tail == True {
return gsl_cdf_chisq_P($a, $b)
} else {
return gsl_cdf_chisq_Q($a, $b)
}
}
say pchisq(3,4);
While executing this script, I get following error:
Cannot locate native library '(null)': /usr/lib/x86_64-linux-gnu/libgsl.so: undefined symbol: cblas_ctrmv
in method setup at /usr/share/perl6/core/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 286
in block gsl_cdf_chisq_P at /usr/share/perl6/core/sources/947BDAB9F96E0E5FCCB383124F923A6BF6F8D76B (NativeCall) line 578
in sub pchisq at chisq.raku line 13
in block <unit> at chisq.raku line 19
From reading the documentation on NativeCall, I am including the shared library libgsl.so
.
Googling showed cblas_ctrmv
was possibly (not sure) related with lapack.
So I searched for liblapack.so
which was indeed present inside /usr/lib
.
echo $LD_LIBRARY_PATH
showed
/usr/local/lib/R/lib::/lib:/usr/local/lib:/usr/lib/x86_64-linux-gnu:/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server
To see if I can fix it, I added /usr/lib
to LD_LIBRARY_PATH
with command export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib
and tried to run the script again.
Still not working, same error message.
I am running code in docker container inside rstudio.
Raku version 2019.11
It has gsl-dev
files and gsl
library.
The container has shared library libgsl.so
inside /usr/lib/x86_64-linux-gnu/
.
Other shared libraries inside this folder are
Is there a way to make it work?
Looks like the base image of rocker/rstudio
is updated to debian:buster
.
After installation of libgsl23
, the problem is resolved.
It works now !!