Closed nh2 closed 5 years ago
You can test this with:
stack build hmatrix --flag hmatrix:no-random_r
I get
/Users/dom/hmatrix/packages/base/src/Internal/C/vector-aux.c:941:9: error:
warning: randomVector is not thread-safe in OSX and FreeBSD or with NO_RANDOM_R [-W#pragma-messages]
|
941 | #pragma message "randomVector is not thread-safe in OSX and FreeBSD or with NO_RANDOM_R"
| ^
#pragma message "randomVector is not thread-safe in OSX and FreeBSD or with NO_RANDOM_R"
Should I be worried?
Should I be worried?
@idontgetoutmuch To some extent: If you use the flag no-random_r
(for example because the libc you want to use doesn't have random_r()
), then you will not be able to benefit of the thread-safety that random_r()
provides.
That is OK though, because the alternative (for now) is not being able to use hmatrix
at all in those cases.
I've pushed another commit that improves the warning and comments to lay out in detail what the problems with that are.
Also, we can fix it long-term by providing our own PRNG, and not relying on the libc for that functionality. I've added a TODO for that.
A false positive :(
@idontgetoutmuch Just to make sure, you got that warning in one of the situations mentioned in the warning, not with glibc on normal Linux, right?
This allows building hmatrix against the musl libc, which allows easily linking Haskell programs statically.
hmatrix
is one of the few packages that don't support this yet.See https://github.com/NixOS/nixpkgs/issues/43795.