The biggest issue seems to be the use of the random_rI() function with is a glibc extension.
I get:
src/Internal/C/vector-aux.c:1066:5: error:
warning: implicit declaration of function ‘random_r’; did you mean ‘random’? [-Wimplicit-function-declaration]
random_r(buffer,&res);
^~~~~~~~
The code already handles absence of random_r on some platforms:
in your #if. That evaluating to 1 means that random_r() is available, otherwise it may not be available.
I would very much appreciate if you can help me with this as static linking will make numerical Haskell programs much easier to deploy and run in a distributed fashion.
I have researched 30 minutes into whether there's a significantly better alternative function to use in musl vs what you do on FreeBSD but haven't found anything real yet.
So it would probably be sufficient for now if musl went down the FreeBSD/OSX code path.
For the advancement of static linking in Haskell (https://github.com/nh2/static-haskell-nix and https://github.com/NixOS/nixpkgs/issues/43795) I'm building all Stackage executables statically, which means building against
musl
libc instead ofglibc
.hmatrix
doesn't compile againstmusl
.The biggest issue seems to be the use of the
random_rI()
function with is aglibc
extension.I get:
The code already handles absence of
random_r
on some platforms:https://github.com/haskell-numerics/hmatrix/blob/94c7f89929e09ca6e98976cb59dec574ee164e20/packages/base/src/Internal/C/vector-aux.c#L935-L942
But the way the decision is done is not good:
defined (__APPLE__) || (__FreeBSD__)
.Instead it should better use the feature test macros as described in the man page, which are specifically designed for this task:
So you should be able to check for the presence of
random_r()
by checkingin your
#if
. That evaluating to1
means thatrandom_r()
is available, otherwise it may not be available.I would very much appreciate if you can help me with this as static linking will make numerical Haskell programs much easier to deploy and run in a distributed fashion.
I have researched 30 minutes into whether there's a significantly better alternative function to use in
musl
vs what you do on FreeBSD but haven't found anything real yet.So it would probably be sufficient for now if musl went down the FreeBSD/OSX code path.
This article may be interesting: