spechub / Hets

The Heterogeneous Tool Set
http://hets.eu
GNU General Public License v2.0
57 stars 19 forks source link

unable to compile uni-graphs #1967

Closed jelmd closed 2 years ago

jelmd commented 4 years ago

uni-graph is required by hets but fails to build on focal:

Graphs/GraphDisp.hs:483:19: error:
    Not in scope: type constructor or class `Typeable1'
    Perhaps you meant `Typeable' (imported from Data.Typeable)
    |
483 |    NodeClass node,Typeable1 node,NodeTypeClass nodeType,
    |                   ^^^^^^^^^

Graphs/GraphDisp.hs:488:17: error:
    Not in scope: type constructor or class `Typeable1'
    Perhaps you meant `Typeable' (imported from Data.Typeable)
    |
488 |    ArcClass arc,Typeable1 arc,ArcTypeClass arcType,
    |                 ^^^^^^^^^

Graphs/GraphDisp.hs:577:8: error:
    Not in scope: type constructor or class `Typeable1'
    Perhaps you meant `Typeable' (imported from Data.Typeable)
    |
577 | class (Typeable1 node,Ord1 node) => NodeClass node
    |        ^^^^^^^^^

Graphs/GraphDisp.hs:579:7: error:
    Not in scope: type constructor or class `Typeable1'
    Perhaps you meant `Typeable' (imported from Data.Typeable)
    |
579 | class Typeable1 nodeType => NodeTypeClass nodeType
    |       ^^^^^^^^^

Graphs/GraphDisp.hs:619:8: error:
    Not in scope: type constructor or class `Typeable1'
    Perhaps you meant `Typeable' (imported from Data.Typeable)
    |
619 | class (Typeable1 arc,Ord1 arc) => ArcClass arc
    |        ^^^^^^^^^

Graphs/GraphDisp.hs:621:8: error:
    Not in scope: type constructor or class `Typeable1'
    Perhaps you meant `Typeable' (imported from Data.Typeable)
    |
621 | class (Typeable1 arcType,Ord1 arcType) => ArcTypeClass arcType where
    |        ^^^^^^^^^

Any hints?

tillmo commented 4 years ago

Strange... Could you show the source please? At https://hackage.haskell.org/package/uni-graphs-2.2.1.1/docs/src/Graphs.GraphDisp.html there is no class Typeable1, only Typeable.

jelmd commented 4 years ago

I use the source package as is from its repo.

jelmd commented 4 years ago

Ehmm, the error above is with 2.2.1.0, the one with 2.2.1.1 is:

Graphs/PureGraphPrune.hs:171:13: error:
    * Data.Map.foldWithKey is gone. Use foldrWithKey.
    * In the expression:
        Map.foldWithKey
          (\ a nodeData fm0
             -> let parents1 = parentNodes nodeData
                in
                  foldl
                    (\ fm0 parent
                       -> Map.insert parent (Map.findWithDefault 0 parent fm0 + 1) fm0)
                    fm0
                    parents1)
          (Map.empty :: Map.Map nodeInfo Int)
          fm
      In an equation for `fm1':
          fm1
            = Map.foldWithKey
                (\ a nodeData fm0
                   -> let parents1 = ...
                      in
                        foldl
                          (\ fm0 parent
                             -> Map.insert parent (Map.findWithDefault 0 parent fm0 + 1) fm0)
                          fm0
                          parents1)
                (Map.empty :: Map.Map nodeInfo Int)
                fm
      In the expression:
        let
          fm1
            = Map.foldWithKey
                (\ a nodeData fm0 -> ...) (Map.empty :: Map.Map nodeInfo Int) fm
        in Map.findWithDefault 0 nf fm1
    |
171 |       fm1 = Map.foldWithKey
    |             ^^^^^^^^^^^^^^^...
tillmo commented 4 years ago

@jelmd how can one reproduce the error?

jelmd commented 4 years ago
apt-get install libghc-uni-{util,events,reactor,posixutil,htk}-dev
wget https://hackage.haskell.org/package/uni-graphs-2.2.1.1/uni-graphs-2.2.1.1.tar.gz
tar xzf uni-graphs-2.2.1.1.tar.gz
cd uni-graphs-2.2.1.1
runhaskell Setup.hs configure --ghc --prefix=/XXXXXX --disable-executable-stripping --disable-benchmarks --libdir=lib/haskell-packages/ghc/lib/x86_64-linux-ghc-8.6.5 --libsubdir=uni-graphs-2.2.1.1 --datadir=share --datasubdir=uni-graphs --haddockdir=lib/ghc-doc/haddock/uni-graphs-2.2.1.1 --docdir=share/doc/uni-graphs-doc --disable-profiling --disable-shared
runhaskell Setup.hs build
tillmo commented 2 years ago

Here is a patch to a (fictitious) version uni-graphs-2.2.1.2 that solves the problem. Maybe we should host the sources here at spechub?

iff -ru uni-graphs-2.2.1.1/Graphs/GraphDisp.hs uni-graphs-2.2.1.2/Graphs/GraphDisp.hs
--- uni-graphs-2.2.1.1/Graphs/GraphDisp.hs  2018-08-06 14:38:27.000000000 +0200
+++ uni-graphs-2.2.1.2/Graphs/GraphDisp.hs  2022-03-22 11:26:59.810385960 +0100
@@ -4,6 +4,7 @@
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE UndecidableInstances #-}
 {-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE MonoLocalBinds #-}

 -- |
 -- Description: Basic Interface for Graph Display
Nur in uni-graphs-2.2.1.2/Graphs: GraphDisp.hs~.
diff -ru uni-graphs-2.2.1.1/Graphs/PureGraphPrune.hs uni-graphs-2.2.1.2/Graphs/PureGraphPrune.hs
--- uni-graphs-2.2.1.1/Graphs/PureGraphPrune.hs 2018-08-06 14:38:27.000000000 +0200
+++ uni-graphs-2.2.1.2/Graphs/PureGraphPrune.hs 2022-03-22 11:27:49.365975509 +0100
@@ -168,7 +168,7 @@
 nChildren :: Ord nodeInfo => PureGraph nodeInfo arcInfo -> nodeInfo -> Int
 nChildren (PureGraph fm :: PureGraph nodeInfo arcInfo) nf =
    let
-      fm1 = Map.foldWithKey
+      fm1 = Map.foldrWithKey
          (\ a nodeData fm0 ->
             let
                parents1 = parentNodes nodeData
jelmd commented 2 years ago

Yepp, works. Package is published (launchpad + pkg.cs).

jelmd commented 2 years ago

Wrt. the patch: it is included in the source package on launchpad and my local repo used to build it. So IMHO there is not really a need to add it to this repo as well.

jelmd commented 2 years ago

BTW: When I try to build uni-udrawgraph I get the following error:

UDrawGraph/Graph.hs:1821:9: error:
    Not in scope: `Data.Dynamic.cast'
    Module `Data.Dynamic' does not export `cast'.
     |
1821 |    case Data.Dynamic.cast valueA of
     |         ^^^^^^^^^^^^^^^^^

Any ideas how to fix?

tillmo commented 2 years ago

How do I solve this?

Configuring uni-uDrawGraph-2.2.1.4...
Setup.hs: Encountered missing dependencies:
uni-graphs -any
jelmd commented 2 years ago

apt-get install libghc-uni-graphs-dev

tillmo commented 2 years ago

That also was my idea. But:

till@till-ThinkPad-X1-Yoga-4th:~$ cat /etc/apt/sources.list.d/csmd.list
deb [trusted=yes] http://pkg.cs.ovgu.de/LNF/linux/ubuntu 20.04/
till@till-ThinkPad-X1-Yoga-4th:~$ cat /etc/apt/sources.list.d/hets-ubuntu-hets-focal.list
deb http://ppa.launchpad.net/hets/hets/ubuntu focal main
# deb-src http://ppa.launchpad.net/hets/hets/ubuntu focal main
till@till-ThinkPad-X1-Yoga-4th:~$ sudo apt update
[...]
till@till-ThinkPad-X1-Yoga-4th:~$ sudo apt-get install libghc-unigraphs-dev
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
E: Paket libghc-unigraphs-dev kann nicht gefunden werden.
jelmd commented 2 years ago

The missing dash after libghc-uni is probably the root cause. Anyway, to make sure I re-build it as well - looks good.

tillmo commented 2 years ago

Thanks, right. Now I can compile it, and get only some warnings. Here is my ghc version:

runhaskell --version
runghc 8.6.5
tillmo commented 2 years ago

Aha, it seems that my source is different (uni-uDrawGraph-2.2.1.4):

coDyn :: (Typeable a,Typeable b) => a -> b
coDyn valueA =
   case cast valueA of
      Just valueB -> valueB
jelmd commented 2 years ago

Yepp. The version works - - uni-* packages are published on launchpad and pkg.cs.

Now we can go back to #2047 (used the fix_tests branch).