haskell-numerics / hmatrix

Linear algebra and numerical computation
381 stars 104 forks source link

Workaround for GHC-8.4.x #245

Closed konn closed 6 years ago

konn commented 6 years ago

GHC-8.4.1-alpha1 had been released, and there is some conflicting API changes there. This pull request resolves such conflicts:

albertoruiz commented 6 years ago

Thanks! I am on a trip now, I will release a new version as soon as possible.

albertoruiz commented 6 years ago

I am trying to build hmatrix with ghc-8.4.1 but I cannot install the vector package, which specifies base < 4.11. Which is your version of vector?

$ ghc-pkg list /opt/ghc/8.4.1/lib/ghc-8.4.0.20171222/package.conf.d Cabal-2.1.0.0 array-0.5.2.0 base-4.11.0.0 binary-0.8.5.1 bytestring-0.10.8.2 containers-0.5.10.2 deepseq-1.4.3.0 directory-1.3.1.5 filepath-1.4.1.2 ghc-8.4.0.20171222

konn commented 6 years ago

You can use packages from HEAD.hackage, which provides latest package information for GHC 8.4.

You can use either make_travis_yml_2.hs from hvr's multi-ghc travis configuration, or custom build-plan for stack. For example, I used the following custom settings for stack:

resolver: ghc-8.4.0.20171214
compiler: ghc-8.4.0.20171214
skip-ghc-check: true

setup-info:
  ghc:
    macosx:
      8.4.0.20171214: 
        url: "https://downloads.haskell.org/~ghc/8.4.1-alpha1/ghc-8.4.0.20171214-x86_64-apple-darwin.tar.xz"
        sha1: f734623712a3e93fb676ee479de0670303a5d777
    linux64:
      8.4.0.20171214: 
        url: "https://downloads.haskell.org/~ghc/8.4.1-alpha1/ghc-8.4.0.20171214-x86_64-deb8-linux.tar.xz"
        sha1: 7c3fe68f0332b038c75c3b92d55878580b7d5d30

flags: {}
packages:
- packages/tests/
- packages/special/
- packages/gsl/
- packages/glpk/
- packages/base/

flags:
  hmatrix-special:
    safe-cheap: false
  hmatrix-tests:
    gsl: true
  hmatrix:
    openblas: false
  hmatrix-gsl:
    onlygsl: false

package-indices:
- name: Hackage Head
  download-prefix: http://head.hackage.haskell.org/package/
  http: http://head.hackage.haskell.org/01-index.tar.gz
- name: Hackage
  download-prefix: http://hackage.haskell.org/package/
  http: http://hackage.haskell.org/01-index.tar.gz

allow-newer: true

extra-deps: 
- HUnit-1.6.0.0
- QuickCheck-2.10.1
- call-stack-0.1.0
- primitive-0.6.2.0
- random-1.1
- semigroups-0.18.3
- split-0.2.3.2
- storable-complex-0.2.2
- tf-random-0.5
- vector-0.12.0.1
konn commented 6 years ago

@albertoruiz Did this information help?

albertoruiz commented 6 years ago

I am sorry, I tried your stack file but made some mistake and couldn't build the package. This is because I am not familiar with stack. (I use cabal with the standard hackage in a docker container.) Could you please describe in detail all the steps I must do to reproduce your results? Thanks!

konn commented 6 years ago

Sure!

First, make sure that you've installed the most recent version of stack:

$ stack --version
Version 1.6.3, Git revision b27e629b8c4ce369e3b8273f04db193b060000db (5454 commits) x86_64 hpack-0.20.0

If the version is older than 1.6.3, please run stack upgrade to make everything up-to-date. Then, save the above yaml file to the root directory (i.e. the same directory as where stack.yaml file is placed currently) named as stack-804.yaml (here, the suffix 804 is chosen arbitrarily just to indicate that it is the custom config file for 8.4.x). Also, I've just pushed the new branch with this file; it currently contains the same contents as master branch, but also includes stack-804.yaml.

Then, you can build and test against ghc-8.4.1-alpha1 with the above settings just by running the following in the root directory of projects:

$ ls
./          .stack-work/        examples/
../         .stylish-haskell.yaml   packages/
.git/           INSTALL.md      stack-804.yaml
.gitignore      README.md       stack.yaml

$ stack --stack-yaml=stack-804.yaml test
WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.0.0. split requires: <4.11
WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.0.0. vector requires: >=4.5 && <4.11
WARNING: Ignoring out of range dependency (allow-newer enabled): base-4.11.0.0. primitive requires: >=4.5 && <4.11
hmatrix-tests-0.6.0.0: unregistering (components added: test:hmatrix-base-testsuite, test:hmatrix-gsl-testsuite)
...
albertoruiz commented 6 years ago

Excellent! All packages have been built without any problem and all tests pass.

Are the changes backwards compatible with ghc-8.2?

Thanks!

konn commented 6 years ago

At least they still compiles with the current stack.yaml, which specifies as a resolver lts-8.15 depending on ghc-8.0.2.

And, they seem compiling with GHC 8.2.x, specifying lts-10.0 (depending on 8.2.x) as a resolver:

$ stack build --resolver=lts-10.0
hmatrix-glpk-0.6.0.0: configure (lib)
hmatrix-glpk-0.6.0.0: build (lib)
...

$ stack test --resolver=lts-10.0
hmatrix-tests-0.6.0.0: unregistering (components added: test:hmatrix-base-testsuite, test:hmatrix-gsl-testsuite)
hmatrix-tests-0.6.0.0: build (lib + test)

By the way, there are some hsc-related warnings during the compilation, which might require some fixes for completion?

albertoruiz commented 6 years ago

I have just checked that it compiles with ghc-8.2 and dependencies in standard hackage. I think that a new hmatrix version can be uploaded to hackage.

Yes, I got a hsc warning in hmatrix-special. It should be fixed.