mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-23 15:34:06 +00:00
clean up build steps & instructions
This commit is contained in:
parent
c80fdac30a
commit
bcd38ed791
|
@ -32,7 +32,7 @@ common common
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
base
|
base
|
||||||
>= 4.16 && < 4.20
|
>= 4.16 && < 4.18
|
||||||
, acts
|
, acts
|
||||||
^>= 0.3.1.0
|
^>= 0.3.1.0
|
||||||
, containers
|
, containers
|
||||||
|
@ -42,9 +42,9 @@ common common
|
||||||
, generic-lens
|
, generic-lens
|
||||||
>= 2.2 && < 2.3
|
>= 2.2 && < 2.3
|
||||||
, groups
|
, groups
|
||||||
^>= 0.5.3
|
^>= 0.5.3
|
||||||
, groups-generic
|
, groups-generic
|
||||||
^>= 0.2
|
^>= 0.3
|
||||||
, primitive
|
, primitive
|
||||||
^>= 0.7.1.0
|
^>= 0.7.1.0
|
||||||
, transformers
|
, transformers
|
||||||
|
@ -76,17 +76,17 @@ common extras
|
||||||
, hashable
|
, hashable
|
||||||
>= 1.3.0.0 && < 1.5
|
>= 1.3.0.0 && < 1.5
|
||||||
, lens
|
, lens
|
||||||
>= 4.19.2 && < 5.2
|
>= 4.19.2 && < 5.3
|
||||||
, mtl
|
, mtl
|
||||||
^>= 2.2.2
|
>= 2.2.2 && < 2.4
|
||||||
, scientific
|
, scientific
|
||||||
^>= 0.3.6.2
|
>= 0.3.6.2 && < 0.3.8
|
||||||
, stm
|
, stm
|
||||||
^>= 2.5.0.0
|
^>= 2.5.0.0
|
||||||
, text
|
, text
|
||||||
>= 1.2.3.1 && < 2.1
|
>= 1.2.3.1 && < 2.1
|
||||||
, unordered-containers
|
, unordered-containers
|
||||||
>= 0.2.11 && < 0.2.16
|
>= 0.2.11 && < 0.2.20
|
||||||
, waargonaut
|
, waargonaut
|
||||||
^>= 0.8.0.2
|
^>= 0.8.0.2
|
||||||
|
|
||||||
|
@ -107,12 +107,10 @@ common gtk
|
||||||
^>= 2.0.24
|
^>= 2.0.24
|
||||||
, gi-gtk
|
, gi-gtk
|
||||||
>= 4.0.3 && < 4.1
|
>= 4.0.3 && < 4.1
|
||||||
--, gi-gtksource
|
|
||||||
-- >= 3.0.23 && < 3.1
|
|
||||||
, haskell-gi
|
, haskell-gi
|
||||||
>= 0.25 && < 0.26
|
>= 0.26 && < 0.27
|
||||||
, haskell-gi-base
|
, haskell-gi-base
|
||||||
>= 0.25 && < 0.26
|
>= 0.26 && < 0.27
|
||||||
|
|
||||||
|
|
||||||
library splines
|
library splines
|
||||||
|
@ -150,7 +148,7 @@ library splines
|
||||||
, prim-instances
|
, prim-instances
|
||||||
^>= 0.2
|
^>= 0.2
|
||||||
, vector
|
, vector
|
||||||
>= 0.12.1.2 && < 0.13
|
>= 0.12.1.2 && < 0.14
|
||||||
|
|
||||||
library metabrushes
|
library metabrushes
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,34 @@
|
||||||
packages: .
|
packages: .
|
||||||
|
|
||||||
constraints:
|
constraints:
|
||||||
acts -finitary
|
acts -finitary
|
||||||
|
|
||||||
allow-newer:
|
allow-newer:
|
||||||
waargonaut:*,
|
digit:lens,
|
||||||
*:haskell-gi-base, *:haskell-gi,
|
hoist-error:base,
|
||||||
*:base, *:template-haskell, *:text,
|
natural:lens,
|
||||||
ghc-typelits-natnormalise:ghc-bignum,
|
prim-instances:base,
|
||||||
integer-logarithms:ghc-bignum,
|
records-sop:ghc-prim,
|
||||||
hashable:ghc-bignum,
|
waargonaut:lens, waargonaut:records-sop, waargonaut:text, waargonaut:witherable
|
||||||
lens:hashable, aeson:hashable
|
|
||||||
|
|
||||||
-- various fixes for 'hmatrix'
|
-- Fix a severe bug in Waargonaut (no corresponding Hackage release???)
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/haskell-numerics/hmatrix
|
location: https://github.com/haskell-waargonaut/waargonaut
|
||||||
tag: e9268cd5ea31322220c0847f2fdce968789693b4
|
tag: 5f838582a8c5aae1a198ecd4958729e53a6b03cf
|
||||||
subdir: packages/base
|
|
||||||
|
|
||||||
-- GHC compat fixes for records-sop
|
-----------------------------
|
||||||
|
-- GHC 9.2 support patches --
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
-- eigen
|
||||||
|
source-repository-package
|
||||||
|
type: git
|
||||||
|
location: https://github.com/chessai/eigen
|
||||||
|
tag: 8fff32a43df743c8c83428a86dd566a0936a4fba
|
||||||
|
|
||||||
|
-- records-sop
|
||||||
source-repository-package
|
source-repository-package
|
||||||
type: git
|
type: git
|
||||||
location: https://github.com/kosmikus/records-sop
|
location: https://github.com/kosmikus/records-sop
|
||||||
tag: abab99b4b870fce55e81dd03d4e41fb50502ca4e
|
tag: abab99b4b870fce55e81dd03d4e41fb50502ca4e
|
||||||
|
|
||||||
package hmatrix
|
|
||||||
ghc-options: "-w"
|
|
||||||
flags: +openblas
|
|
||||||
|
|
||||||
source-repository-package
|
|
||||||
type: git
|
|
||||||
location: https://github.com/well-typed/large-records
|
|
||||||
subdir: large-generics
|
|
||||||
large-anon
|
|
||||||
tag: acb837a9a4c22cea1abf552b47f9d3bf5af2fbdf
|
|
||||||
|
|
||||||
package *
|
|
||||||
ghc-options: "-finfo-table-map" "-fdistinct-constructor-tables"
|
|
||||||
|
|
|
@ -2,34 +2,28 @@
|
||||||
# Installation notes
|
# Installation notes
|
||||||
|
|
||||||
On Windows, we need to install an up-to-date MinGW/MSYS2 toolchain,
|
On Windows, we need to install an up-to-date MinGW/MSYS2 toolchain,
|
||||||
together with the packages required by the `haskell-gi` libraries (for `GTK`),
|
together with the packages required by the `haskell-gi` libraries (for `GTK`).
|
||||||
the `hmatrix` library, as well as `flint` and `msolve`.
|
|
||||||
|
|
||||||
With an `MSYS2` installation, the following environment variables will need to be set (with `MSYS2` installed at `C:\msys64`):
|
With an `MSYS2` installation at `C:\Haskell\ghcup\msys64`, the following environment variables will need to be set :
|
||||||
|
|
||||||
`PATH`: `C:\msys64\mingw64\bin;C:\msys64\usr\bin`
|
`PATH`: `C:\Haskell\ghcup\msys64\mingw64\bin;C:\Haskell\ghcup\msys64\usr\bin`
|
||||||
`PKG_CONFIG_PATH`: `C:\msys64\mingw64\lib\pkgconfig`
|
`PKG_CONFIG_PATH`: `C:\Haskell\ghcup\msys64\mingw64\lib\pkgconfig`
|
||||||
`XDG_DATA_DIRS`: `C:\msys64\mingw64\share;C:\msys64\usr\share`
|
`XDG_DATA_DIRS`: `C:\Haskell\ghcup\msys64\mingw64\share;C:\Haskell\ghcup\msys64\usr\share`
|
||||||
|
|
||||||
|
Then we need `pkg-config` and the suite of `GTK` libraries.
|
||||||
Then we install some necessary packages using the following command:
|
After updating the package database if necessary with `pacman -Sy msys2-keyring`, we can do:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-openblas
|
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-gobject-introspection mingw64/mingw-w64-x86_64-atk mingw64/mingw-w64-x86_64-gtksourceview5
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, `flint`, which `msolve` depends on.
|
NB: at the time of writing, the relevant gtksource version is 5; this might need to be
|
||||||
|
updated if you run into issues, as the API of the auto-generated Haskell gi libraries might be
|
||||||
|
different dependent on the version numbers of the gi foreign libraries.
|
||||||
|
|
||||||
Build `flint` by downloading it and running the configure script. On Windows (MINGW64):
|
Note that GHC 9.2 and below are affected by some bugs on Windows, e.g. [#21109](https://gitlab.haskell.org/ghc/ghc/-/issues/21109)
|
||||||
|
and [#21111](https://gitlab.haskell.org/ghc/ghc/-/issues/21111). So you should use GHC 9.4 (or above),
|
||||||
```bash
|
and make sure that you are using `cabal-install > 3.8` (due to [#21990](https://gitlab.haskell.org/ghc/ghc/-/issues/21990)).
|
||||||
./configure ABI=64 --build=${MINGW_CHOST} --prefix=${MINGW_PREFIX} --enable-static --disable-shared --with-gmp=${MINGW_PREFIX} --with-mpfr=${MINGW_PREFIX}
|
|
||||||
make && make install
|
|
||||||
```
|
|
||||||
|
|
||||||
`flint` needs `gmp`, `mpfr`, but these should already be present.
|
|
||||||
|
|
||||||
For `msolve`, the default installation directions (`./autogen.sh`, `./configure`, `make && make install`) seem to work (without having to set any additional options), as of `msolve` version `0.1.3`.
|
|
||||||
|
|
||||||
## Possible errors
|
## Possible errors
|
||||||
|
|
||||||
|
@ -53,6 +47,7 @@ to install it.
|
||||||
### gobject could not be found
|
### gobject could not be found
|
||||||
|
|
||||||
An error such as
|
An error such as
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
The pkg-config package 'gobject' is required but it could not be found.
|
The pkg-config package 'gobject' is required but it could not be found.
|
||||||
```
|
```
|
||||||
|
@ -68,6 +63,64 @@ pkg-config --list-all
|
||||||
If packages such as `cairo`, `gtk` etc do not appear, this means `PKG_CONFIG_PATH` is not set correctly.
|
If packages such as `cairo`, `gtk` etc do not appear, this means `PKG_CONFIG_PATH` is not set correctly.
|
||||||
Search for `*.pc` files in your `MSYS2` installation, and ensure their paths are included in `PKG_CONFIG_PATH`.
|
Search for `*.pc` files in your `MSYS2` installation, and ensure their paths are included in `PKG_CONFIG_PATH`.
|
||||||
|
|
||||||
|
You might also have multiple different `pkg-config` executables in your `PATH`;
|
||||||
|
if so, ensure that `cabal` is using the correct one, e.g. by modifying the `extra-prog-path`
|
||||||
|
field in your `cabal.config` file; see e.g. [ghcup issue #371](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/371).
|
||||||
|
|
||||||
|
### Missing (or bad) C libraries
|
||||||
|
|
||||||
|
An error of the form:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Missing dependencies on foreign libraries:
|
||||||
|
* Missing (or bad) C libraries: gobject-2.0
|
||||||
|
```
|
||||||
|
|
||||||
|
indicates that `cabal` is not able to find an external C dependency. If the
|
||||||
|
C dependency is indeed installed, then perhaps `cabal` is calling the wrong
|
||||||
|
`pkg-config` executable. This could be due to an incorrect `extra-prog-path`
|
||||||
|
in your `cabal.config` file; see e.g. [ghcup issue #371](https://gitlab.haskell.org/haskell/ghcup-hs/-/issues/371).
|
||||||
|
|
||||||
|
To fix this, you need to ensure the `pkg-config` executable is correct, e.g.
|
||||||
|
by re-ordering the paths in the `extra-prog-path` stanza so that the path
|
||||||
|
containing the correct `pkg-config` appears first.
|
||||||
|
|
||||||
|
|
||||||
|
### Failed to load shared library
|
||||||
|
|
||||||
|
An error of the form
|
||||||
|
|
||||||
|
```bash
|
||||||
|
Failed to load shared library 'libcairo-gobject-2.dll' referenced by the typelib: 'libcairo-gobject-2.dll': The specified procedure could not be found.
|
||||||
|
gi-cairo> Could not resolve symbol "cairo_gobject_context_get_type" in namespace "cairo"
|
||||||
|
```
|
||||||
|
|
||||||
|
indicates an issue finding exported functions in the `DLL`s that we depend upon.
|
||||||
|
I'm not yet sure how to fix this issue; see [haskell-gi issue #391](https://github.com/haskell-gi/haskell-gi/issues/391).
|
||||||
|
|
||||||
|
### Error compiling C standard libraries
|
||||||
|
|
||||||
|
An error of the form
|
||||||
|
|
||||||
|
```bash
|
||||||
|
C:\Haskell\ghcup\ghc\9.4.3\lib\..\mingw\include\c++\v1\cmath:642:26: error:
|
||||||
|
error: no template named 'numeric_limits'
|
||||||
|
```
|
||||||
|
|
||||||
|
signals that GHC is getting confused about which Unix toolchain to use. This
|
||||||
|
might be due to having
|
||||||
|
|
||||||
|
```cabal
|
||||||
|
extra-include-dirs: C:\Haskell\ghcup\msys64\mingw64\include
|
||||||
|
```
|
||||||
|
|
||||||
|
in your global `cabal.config` file, or in your `cabal.project.local` file.
|
||||||
|
You should **not** specify `extra-include-dirs` on a per-package
|
||||||
|
basis in your `cabal.project.local` file either: these should be handled by `pkg-config`.
|
||||||
|
|
||||||
|
Remove any `extra-include-dirs` and `extra-lib-dirs`, both in your global `cabal.config`
|
||||||
|
and in local `cabal.project`/`cabal.project.local` files to proceed.
|
||||||
|
|
||||||
### ...is a relative path which makes no sense
|
### ...is a relative path which makes no sense
|
||||||
|
|
||||||
Any error of the form:
|
Any error of the form:
|
||||||
|
@ -85,7 +138,7 @@ pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-pkg-config
|
||||||
```
|
```
|
||||||
|
|
||||||
This should fix the issue. Another solution is to pass the `--force` flag to `ghc-pkg` for the problematic packages.
|
This should fix the issue. Another solution is to pass the `--force` flag to `ghc-pkg` for the problematic packages.
|
||||||
At the time of writing, the only dependency which presents this problem is `graphite2`, which is a dependency of `cairo`.
|
One dependency which used to present this problem was `graphite2`, which is a dependency of `cairo`.
|
||||||
This causes a problem with the `gi-cairo-render` library, so in the `cabal.project` file we can specify:
|
This causes a problem with the `gi-cairo-render` library, so in the `cabal.project` file we can specify:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -105,74 +158,5 @@ Libs: -L${libdir} -lgraphite2
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
```
|
```
|
||||||
|
|
||||||
See [this patch](https://github.com/msys2/MINGW-packages/pull/6966). The package `fontconfig` also presented this issue; this was resolved in [this patch](https://github.com/msys2/MINGW-packages/issues/872).
|
See [this patch](https://github.com/msys2/MINGW-packages/pull/6966).
|
||||||
|
The package `fontconfig` also presented this issue; this was resolved in [this patch](https://github.com/msys2/MINGW-packages/issues/872).
|
||||||
### Missing C library `openblas`
|
|
||||||
|
|
||||||
The error message
|
|
||||||
|
|
||||||
```
|
|
||||||
Missing dependencies on foreign libraries:
|
|
||||||
* Missing (or bad) C library: openblas
|
|
||||||
```
|
|
||||||
|
|
||||||
indicates that `cabal` could not find a C library that `hmatrix` depends on.
|
|
||||||
|
|
||||||
Make sure that `openblas` is installed:
|
|
||||||
|
|
||||||
```
|
|
||||||
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-openblas
|
|
||||||
```
|
|
||||||
|
|
||||||
then ensure that `cabal` can find it, for instance:
|
|
||||||
|
|
||||||
```
|
|
||||||
package hmatrix
|
|
||||||
extra-lib-dirs: "C:/msys64/mingw64/bin"
|
|
||||||
extra-include-dirs: "C:/msys64/mingw64/include"
|
|
||||||
```
|
|
||||||
|
|
||||||
enables `cabal` to find `C:/msys64/mingw64/bin/libopenblas.dll`.
|
|
||||||
|
|
||||||
### The code execution cannot proceed because libgfortran_64-3.dll was not found
|
|
||||||
|
|
||||||
An error such as
|
|
||||||
|
|
||||||
```
|
|
||||||
The code execution cannot proceed because libgfortran_64-3.dll was not found
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
```
|
|
||||||
The code execution cannot proceed because libgcc_s_seh_64-1.dll was not found
|
|
||||||
```
|
|
||||||
|
|
||||||
indicates that a dependency of `BLAS` could not be loaded. These should have been installed as dependencies of `openblas` (see previous error), but otherwise you can try:
|
|
||||||
|
|
||||||
```
|
|
||||||
pacman -S -q --noconfirm mingw64/mingw-w64-x86_64-gcc-fortran mingw64/mingw-w64-x86_64-gcc
|
|
||||||
```
|
|
||||||
|
|
||||||
### addDLL: library not loaded
|
|
||||||
|
|
||||||
The error message
|
|
||||||
|
|
||||||
```
|
|
||||||
addDLL: libopenblas or dependencies not loaded. (Win32 error 126)
|
|
||||||
```
|
|
||||||
|
|
||||||
means that `GHC` was not able to find the `BLAS` library, or a dependency thereof.
|
|
||||||
|
|
||||||
Follow the previous two steps to ensure both the library and its dependencies can be found.
|
|
||||||
|
|
||||||
|
|
||||||
### Unknown symbol dgesvd_
|
|
||||||
|
|
||||||
An error of the form
|
|
||||||
|
|
||||||
```
|
|
||||||
ghc.exe: | MetaBrush\dist-newstyle\build\x86_64-windows\ghc-8.8.4\hmatrix-0.20.0.0\build\libHShmatrix-0.20.0.0-inplace.a: unknown symbol `dgesvd_'
|
|
||||||
```
|
|
||||||
|
|
||||||
indicates that `GHC` was not able to load symbols for the `hmatrix` dependency. This should be solved in the same way as the previous error.
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
{-# LANGUAGE StandaloneKindSignatures #-}
|
{-# LANGUAGE StandaloneKindSignatures #-}
|
||||||
{-# LANGUAGE TypeApplications #-}
|
{-# LANGUAGE TypeApplications #-}
|
||||||
{-# LANGUAGE TypeFamilyDependencies #-}
|
{-# LANGUAGE TypeFamilyDependencies #-}
|
||||||
|
{-# LANGUAGE TypeOperators #-}
|
||||||
{-# LANGUAGE UndecidableInstances #-}
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
|
|
||||||
module MetaBrush.DSL.Interpolation
|
module MetaBrush.DSL.Interpolation
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
{-# LANGUAGE RecordWildCards #-}
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
{-# LANGUAGE TypeApplications #-}
|
{-# LANGUAGE TypeApplications #-}
|
||||||
|
{-# LANGUAGE TypeOperators #-}
|
||||||
|
|
||||||
module MetaBrush.Document.Draw
|
module MetaBrush.Document.Draw
|
||||||
( DrawAnchor(..), anchorsAreComplementary
|
( DrawAnchor(..), anchorsAreComplementary
|
||||||
|
|
|
@ -216,7 +216,7 @@ myIntersect (MkR r2) =
|
||||||
MkR d -> MkR (HashMap.intersection d r2)
|
MkR d -> MkR (HashMap.intersection d r2)
|
||||||
|
|
||||||
proveRecordDicts :: forall c r x. Record (Dict c) r -> (AllFields c r => x) -> x
|
proveRecordDicts :: forall c r x. Record (Dict c) r -> (AllFields c r => x) -> x
|
||||||
proveRecordDicts = withDict
|
proveRecordDicts = withDict @(AllFields c r)
|
||||||
|
|
||||||
describeRecord :: forall kvs. AllFields Typeable kvs => [ ( Text, TypeRep ) ]
|
describeRecord :: forall kvs. AllFields Typeable kvs => [ ( Text, TypeRep ) ]
|
||||||
describeRecord = collapse $ cmapWithKey @Typeable describeField (recordDicts @Typeable @kvs)
|
describeRecord = collapse $ cmapWithKey @Typeable describeField (recordDicts @Typeable @kvs)
|
||||||
|
|
|
@ -78,20 +78,3 @@ data Segment p =
|
||||||
deriving Applicative
|
deriving Applicative
|
||||||
via Generically1 Segment
|
via Generically1 Segment
|
||||||
deriving anyclass ( NFData, NFData1 )
|
deriving anyclass ( NFData, NFData1 )
|
||||||
|
|
||||||
|
|
||||||
-- TODO: move the following to the groups or groups-generic package.
|
|
||||||
ginvert :: forall g. ( Generic g, Group ( Rep g () ) ) => g -> g
|
|
||||||
ginvert = to . invert @( Rep g () ) . from
|
|
||||||
|
|
||||||
gpow :: forall n g. ( Integral n, Generic g, Group ( Rep g () ) ) => g -> n -> g
|
|
||||||
gpow x n = to ( pow @( Rep g () ) ( from x ) n )
|
|
||||||
|
|
||||||
instance
|
|
||||||
( Generic g
|
|
||||||
, Monoid ( Generically g )
|
|
||||||
, Group ( Rep g () )
|
|
||||||
)
|
|
||||||
=> Group ( Generically g ) where
|
|
||||||
invert (Generically x) = Generically (ginvert x)
|
|
||||||
pow (Generically x) n = Generically (gpow x n)
|
|
||||||
|
|
Loading…
Reference in a new issue