haskell-numerics / hmatrix

Linear algebra and numerical computation
381 stars 104 forks source link

Add disable-default-paths flags for hermetic builds #219

Closed nh2 closed 7 years ago

nh2 commented 7 years ago

This line sets extra-lib-dirs: /usr/... which doesn't make sense on some systems / Linux distributions, or when you want hermetic builds as on nix.

    if os(linux)
        if flag(openblas)
            extra-lib-dirs:     /usr/lib/openblas/lib
            extra-libraries:    openblas
        else
            extra-libraries:    blas lapack

This PR adds a flag (off by default) to disable the use of these default paths.

nh2 commented 7 years ago

CC @peti

nh2 commented 7 years ago

As an aside:

At some point in the future, we probably get rid of the hardcoded paths for openblas altogether, because pkgconfig support was just merged into openblas 18 days ago; but it'll take a couple years for this to be reflected in all Linux distributions.

peti commented 7 years ago

IMHO, listing all kinds of system specific paths in the Cabal file is a dubious effort at best, especially if there is no clean way for the user to disable those defaults. It's much better to let the user specify the correct paths for their system with --extra-include-dir and --extra-lib-dir at configure time.

nh2 commented 7 years ago

@peti I do understand hmatrix's intentions though: It is convenient for the users to be able to just install it without having to know / learn about the own distribution's paths -- as a nice service kindly provided by the package maintainer.

It will eventually become unnecessary with the upstream project (openblas) providing pkgconfig.

But until then I find it is an acceptably clean solution to have this disable-default-paths flag that disables these defaults.

nh2 commented 7 years ago

@albertoruiz A friendly ping :)

idontgetoutmuch commented 7 years ago

This seems very reasonable to me: everyone can carry on without changing anything but users who care (e.g. nix users) can set the flag to true. @albertoruiz do you need any more information from @nh2?

albertoruiz commented 7 years ago

Sorry for the delay!

Thanks to everyone.

nh2 commented 7 years ago

Thanks!