haskell-numerics / random-fu

A suite of Haskell libraries for representing, manipulating, and sampling random variables
42 stars 21 forks source link

`cabal install -p random-fu` fails #48

Closed shuiruge closed 4 years ago

shuiruge commented 5 years ago

I'm new in Haskell, trying to profile my Haskell program using ghc -prof. To do so, I have to reinstall random-fu with an extra -p, like cabal install --reinstall -p random-fu, but failed. The error message is pretty long. But almost all pieces share the same pattern, like:

src/Data/Random/Distribution/Normal.hs:202:46: warning: [-Wtype-defaults]
    • Defaulting the following constraints to type ‘Integer’
        (Integral b0)
          arising from a use of ‘^’
          at src/Data/Random/Distribution/Normal.hs:202:46-81
        (Num b0)
          arising from the literal ‘2’
          at src/Data/Random/Distribution/Normal.hs:202:81
    • In the expression: ((realToFrac x) - (realToFrac mu)) ^ 2
      In the first argument of ‘(/)’, namely
        ‘(- ((realToFrac x) - (realToFrac mu)) ^ 2)’
      In the first argument of ‘exp’, namely
        ‘((- ((realToFrac x) - (realToFrac mu)) ^ 2) / (2 * sigma2))’
    |
202 |   (recip (sqrt (2 * pi * sigma2))) * (exp ((-((realToFrac x) - (realToFrac mu))^2) / (2 * sigma2)))
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/Data/Random/Distribution/Normal.hs:204:14: warning: [-Wtype-defaults]
    • Defaulting the following constraints to type ‘Integer’
        (Integral b0)
          arising from a use of ‘^’
          at src/Data/Random/Distribution/Normal.hs:204:14-31
        (Num b0)
          arising from the literal ‘2’
          at src/Data/Random/Distribution/Normal.hs:204:31
    • In the expression: realToFrac sigma ^ 2
      In an equation for ‘sigma2’: sigma2 = realToFrac sigma ^ 2
      In an equation for ‘normalPdf’:
          normalPdf mu sigma x
            = (recip (sqrt (2 * pi * sigma2)))
                * (exp ((- ((realToFrac x) - (realToFrac mu)) ^ 2) / (2 * sigma2)))
            where
                sigma2 = realToFrac sigma ^ 2
    |
204 |     sigma2 = realToFrac sigma^2
    |              ^^^^^^^^^^^^^^^^^^

Can anyone help me?

idontgetoutmuch commented 5 years ago

They are warnings. Is the build failing because of warnings? If so turn the warnings off.

shuiruge commented 5 years ago

@idontgetoutmuch Ah, you are right, the final error is:

src/Data/Random/Internal/TH.hs:21:1: error:
    Could not find module ‘Data.Generics’
    Perhaps you haven't installed the profiling libraries for package ‘syb-0.7’?
    Use -v to see a list of the files searched for.
   |
21 | import Data.Generics
   | ^^^^^^^^^^^^^^^^^^^^
cabal: Leaving directory '/var/folders/ns/7cfc836x3kg27q5cx7mxzsq80000gn/T/cabal-tmp-48130/random-fu-0.2.7.0'
cabal: Error: some packages failed to install:
random-fu-0.2.7.0-JPrQDbCVRBFABdZ8dT4f3z failed during the building phase. The
exception was:
ExitFailure 1

And then fails.

int-e commented 4 years ago

Oh, this is a year old already. But I think the last error indicates that you needed to build the profiling versions of syb, which cabal-install doesn't figure out automatically. I'll close this.