Closed RyanGlScott closed 5 years ago
I just screwed up some CPP. I'll upload fix tomorrow. Thanks for the report!
@RyanGlScott I think I fixed bug in current master. Could you check that it's indeed fixed? I don't have any windows box at hand
While bos/math-functions@84ea92943a7e5cff6681b5b0f032e64b76fafa4d does work around the issue, it's overly conservative in that it prevents any version of Windows from linking against the system expm1
. The issue observed in https://github.com/bos/math-functions/issues/56#issue-490642288 (namely, GHC #11223) only occurs with Windows GHC 7.10.3 or earlier, so Windows GHC 8.0 and later can use the system expm1
just fine. I believe the conditional logic in the .cabal
file should be closer to this:
diff --git a/math-functions.cabal b/math-functions.cabal
index 375a892..86f6c15 100644
--- a/math-functions.cabal
+++ b/math-functions.cabal
@@ -58,7 +58,7 @@ library
, vector >= 0.7
, primitive
, vector-th-unbox >= 0.2.1.6
- if flag(system-expm1) && !os(windows)
+ if flag(system-expm1) && !(os(windows) && !impl(ghc >= 8.0))
cpp-options: -DUSE_SYSTEM_EXPM1
if flag(system-erf) && !impl(ghcjs)
cpp-options: -DUSE_SYSTEM_ERF
(For comparison, this is basically identical to how the log-domain
library does things, as it has to work around the same issue.)
After applying this change, I can successfully build statistics-0.15.0.0
with both GHC 7.10.3 and 8.6.5, with or without the system-expm1
flag enabled in math-functions
.
With GHC>=8.0 math-functions just use GHC.Float.expm1 :: Floating a => a -> a
unconditionally and flag value is ignored. In fact we have to juggle 3 implementations: one provided by GHC, one coming from C and pure haskell.
My apologies, I did not realize that USE_SYSTEM_EXPM1
was only used on GHC <8.0. In that case, my suggested conditional logic is unnecessary, so 84ea92943a7e5cff6681b5b0f032e64b76fafa4d looks good to me.
0.3.2.1 with fix is on hackage
I recently observed a build failure on Windows GHCs older than 8.0 on this CI build. Here is the relevant excerpt from a Windows GHC 7.10.3 build:
This is likely due to an old GHC bug (https://gitlab.haskell.org/ghc/ghc/issues/11223) that was fixed in GHC 8.0.
This error goes away if I downgrade to
math-functions-0.3.1.0
. I also tried compilingmath-functions-0.3.2.0
with-f-system-expm1
, but that simply caused build failures: