39aldo39 / klfc

Keyboard Layout Files Creator
GNU General Public License v3.0
222 stars 12 forks source link

Build failures #40

Closed ghost closed 2 years ago

ghost commented 2 years ago

Cloning the repo, switching to tag v1.5.6 and attempting to build cabal (by running cabal install) leads to the following error message:

Failed to build keyboard-layout-files-creator-1.5.6.
Build log (
/home/user/.cabal/logs/ghc-9.0.1/keyboard-layout-files-creator-1.5.6-7fca942ae05080a38a2c10ea78bf7257bf45d078a09aaa9ce8cad5ffb1603133.log
):
Configuring keyboard-layout-files-creator-1.5.6...
Preprocessing executable 'klfc' for keyboard-layout-files-creator-1.5.6..
Building executable 'klfc' for keyboard-layout-files-creator-1.5.6..
[ 1 of 40] Compiling JsonComments     ( src/JsonComments.hs, dist/build/klfc/klfc-tmp/JsonComments.dyn_o )
[ 2 of 40] Compiling JsonPretty       ( src/JsonPretty.hs, dist/build/klfc/klfc-tmp/JsonPretty.dyn_o )

src/JsonPretty.hs:139:91: error:
    • Couldn't match type: Data.Aeson.KeyMap.KeyMap Value
                     with: Data.HashMap.Internal.HashMap T.Text Value
      Expected: Data.HashMap.Internal.HashMap T.Text Value
        Actual: aeson-2.0.1.0:Data.Aeson.Types.Internal.Object
    • In the first argument of ‘H.toList’, namely ‘m’
      In the first argument of ‘pstSort’, namely ‘(H.toList m)’
      In the fifth argument of ‘fromCompound’, namely
        ‘(pstSort (H.toList m))’
    |
139 |     go (Object m) = fromCompound st ("{","}") delim (fromPair delims') (pstSort (H.toList m))
    |                                                                                           ^
cabal: Failed to build keyboard-layout-files-creator-1.5.6. See the build log
above for details.

The master branch also fails to compile with the following error message:

Failed to build keyboard-layout-files-creator-1.5.7.
Build log (
/home/user/.cabal/logs/ghc-9.0.1/keyboard-layout-files-creator-1.5.7-7a47f650a6a8a576b48f08b1d8a1800c1840aa8182f39eff83e99bd5ac487bd4.log
):
Warning: keyboard-layout-files-creator.cabal:75:39: version operators used. To
use version operators the package needs to specify at least 'cabal-version: >=
1.8'.
Configuring keyboard-layout-files-creator-1.5.7...
Preprocessing executable 'klfc' for keyboard-layout-files-creator-1.5.7..
Building executable 'klfc' for keyboard-layout-files-creator-1.5.7..
[ 1 of 40] Compiling JsonComments     ( src/JsonComments.hs, dist/build/klfc/klfc-tmp/JsonComments.dyn_o )
[ 2 of 40] Compiling JsonPretty       ( src/JsonPretty.hs, dist/build/klfc/klfc-tmp/JsonPretty.dyn_o )
[ 3 of 40] Compiling Paths_keyboard_layout_files_creator ( dist/build/klfc/autogen/Paths_keyboard_layout_files_creator.hs, dist/build/klfc/klfc-tmp/Paths_keyboard_layout_files_creator.dyn_o )
[ 4 of 40] Compiling Stream           ( src/Stream.hs, dist/build/klfc/klfc-tmp/Stream.dyn_o )
[ 5 of 40] Compiling Util             ( src/Util.hs, dist/build/klfc/klfc-tmp/Util.dyn_o )

src/Util.hs:83:20: error:
    • Couldn't match type ‘γ0’
                     with ‘(Maybe α -> σ0 -> σ0) -> (σ0 -> Maybe α) -> Lens' σ0 α’
      Expected: (σ0 -> α) -> γ0
        Actual: (σ0 -> α)
                -> (Maybe α -> σ0 -> σ0) -> (σ0 -> Maybe α) -> Lens' σ0 α
      Cannot instantiate unification variable ‘γ0’
      with a type involving polytypes:
        (Maybe α -> σ0 -> σ0) -> (σ0 -> Maybe α) -> Lens' σ0 α
    • In the first argument of ‘(∘)’, namely ‘lensWithDefault’
      In the expression: lensWithDefault ∘ const
      In an equation for ‘lensWithDefault'’:
          lensWithDefault' = lensWithDefault ∘ const
    • Relevant bindings include
        lensWithDefault' :: α
                            -> (Maybe α -> σ -> σ) -> (σ -> Maybe α) -> Lens' σ α
          (bound at src/Util.hs:83:1)
   |
83 | lensWithDefault' = lensWithDefault ∘ const
   |                    ^^^^^^^^^^^^^^^

src/Util.hs:83:20: error:
    • Couldn't match type ‘γ0’
                     with ‘(Maybe α -> σ -> σ) -> (σ -> Maybe α) -> Lens' σ α’
      Expected: α -> (Maybe α -> σ -> σ) -> (σ -> Maybe α) -> Lens' σ α
        Actual: α -> γ0
      Cannot instantiate unification variable ‘γ0’
      with a type involving polytypes:
        (Maybe α -> σ -> σ) -> (σ -> Maybe α) -> Lens' σ α
    • In the expression: lensWithDefault ∘ const
      In an equation for ‘lensWithDefault'’:
          lensWithDefault' = lensWithDefault ∘ const
    • Relevant bindings include
        lensWithDefault' :: α
                            -> (Maybe α -> σ -> σ) -> (σ -> Maybe α) -> Lens' σ α
          (bound at src/Util.hs:83:1)
   |
83 | lensWithDefault' = lensWithDefault ∘ const
   |                    ^^^^^^^^^^^^^^^^^^^^^^^
cabal: Failed to build keyboard-layout-files-creator-1.5.7. See the build log
above for details.

possible useful info:

library-vanilla: False
shared: True
executable-dynamic: True
program-default-options
  ghc-options: -dynamic

system: manjaro linux, ghc and cabal from the official repos

AUR build of the package klfc also fails: cabal: unrecognised command: v1-sandbox (try --help)

The latest binary uploaded to github fails due to libffi.so.7 not being found (system only has version 8).

Edit: I also have the issue described in #39

39aldo39 commented 2 years ago

Version v1.5.6 doesn't compile anymore due to an update to a dependency (fixed in a636eab). Version v.1.5.7 fixes it, but after some investigation it looks like GHC 9.0.1 had a breaking change (see this). I don't understand the reasoning fully myself, but I am quite surprised that seemingly equivalent programs aren't all valid anymore with this breaking change (???)

Anyway, it looks like the only affected line is line 83 in src/Utils.hs: lensWithDefault' = lensWithDefault ∘ const. I don't have GHC 9.0.1 myself, but could you try which of the following changes do compile:

ghost commented 2 years ago

I have tried both modifications to line 83:

Result:

Failed to build keyboard-layout-files-creator-1.5.7.
Build log (
/home/user/.cabal/logs/ghc-9.0.1/keyboard-layout-files-creator-1.5.7-5160acee156172ad4373b00c87b5808156082037b938dd5a27a165720a49d369.log
):
Warning: keyboard-layout-files-creator.cabal:75:39: version operators used. To
use version operators the package needs to specify at least 'cabal-version: >=
1.8'.
Configuring keyboard-layout-files-creator-1.5.7...
Preprocessing executable 'klfc' for keyboard-layout-files-creator-1.5.7..
Building executable 'klfc' for keyboard-layout-files-creator-1.5.7..
[ 1 of 40] Compiling JsonComments     ( src/JsonComments.hs, dist/build/klfc/klfc-tmp/JsonComments.dyn_o )
[ 2 of 40] Compiling JsonPretty       ( src/JsonPretty.hs, dist/build/klfc/klfc-tmp/JsonPretty.dyn_o )
[ 3 of 40] Compiling Paths_keyboard_layout_files_creator ( dist/build/klfc/autogen/Paths_keyboard_layout_files_creator.hs, dist/build/klfc/klfc-tmp/Paths_keyboard_layout_files_creator.dyn_o )
[ 4 of 40] Compiling Stream           ( src/Stream.hs, dist/build/klfc/klfc-tmp/Stream.dyn_o )
[ 5 of 40] Compiling Util             ( src/Util.hs, dist/build/klfc/klfc-tmp/Util.dyn_o )
[ 6 of 40] Compiling Permutation      ( src/Permutation.hs, dist/build/klfc/klfc-tmp/Permutation.dyn_o )
[ 7 of 40] Compiling Layout.Pos       ( src/Layout/Pos.hs, dist/build/klfc/klfc-tmp/Layout/Pos.dyn_o )
[ 8 of 40] Compiling Layout.Mod       ( src/Layout/Mod.hs, dist/build/klfc/klfc-tmp/Layout/Mod.dyn_o )
[ 9 of 40] Compiling Layout.DeadKey   ( src/Layout/DeadKey.hs, dist/build/klfc/klfc-tmp/Layout/DeadKey.dyn_o )
[10 of 40] Compiling PresetDeadKey    ( src/PresetDeadKey.hs, dist/build/klfc/klfc-tmp/PresetDeadKey.dyn_o )
[11 of 40] Compiling Layout.Action    ( src/Layout/Action.hs, dist/build/klfc/klfc-tmp/Layout/Action.dyn_o )
[12 of 40] Compiling Filter           ( src/Filter.hs, dist/build/klfc/klfc-tmp/Filter.dyn_o )
[13 of 40] Compiling FileType         ( src/FileType.hs, dist/build/klfc/klfc-tmp/FileType.dyn_o )
[14 of 40] Compiling WithBar          ( src/WithBar.hs, dist/build/klfc/klfc-tmp/WithBar.dyn_o )
[15 of 40] Compiling WithPlus         ( src/WithPlus.hs, dist/build/klfc/klfc-tmp/WithPlus.dyn_o )

src/WithPlus.hs:7:7: error:
    Ambiguous occurrence ‘singleton’
    It could refer to
       either ‘BasePrelude.singleton’,
              imported from ‘BasePrelude’ at src/WithPlus.hs:12:1-44
              (and originally defined in ‘base-4.15.0.0:Data.OldList’)
           or ‘WithPlus.singleton’, defined at src/WithPlus.hs:32:1
  |
7 |     , singleton
  |       ^^^^^^^^^
cabal: Failed to build keyboard-layout-files-creator-1.5.7. See the build log
above for details.

Seems like compiling Util was successful now.

(as far as I can see it is the same error message when compiling WithPlus)

Failed to build keyboard-layout-files-creator-1.5.7.
Build log (
/home/user/.cabal/logs/ghc-9.0.1/keyboard-layout-files-creator-1.5.7-c05c0690b0cc2268d937b6df250af65ce8ac1dd6a07bafcc410264ed4292beb1.log
):
Warning: keyboard-layout-files-creator.cabal:75:39: version operators used. To
use version operators the package needs to specify at least 'cabal-version: >=
1.8'.
Configuring keyboard-layout-files-creator-1.5.7...
Preprocessing executable 'klfc' for keyboard-layout-files-creator-1.5.7..
Building executable 'klfc' for keyboard-layout-files-creator-1.5.7..
[ 1 of 40] Compiling JsonComments     ( src/JsonComments.hs, dist/build/klfc/klfc-tmp/JsonComments.dyn_o )
[ 2 of 40] Compiling JsonPretty       ( src/JsonPretty.hs, dist/build/klfc/klfc-tmp/JsonPretty.dyn_o )
[ 3 of 40] Compiling Paths_keyboard_layout_files_creator ( dist/build/klfc/autogen/Paths_keyboard_layout_files_creator.hs, dist/build/klfc/klfc-tmp/Paths_keyboard_layout_files_creator.dyn_o )
[ 4 of 40] Compiling Stream           ( src/Stream.hs, dist/build/klfc/klfc-tmp/Stream.dyn_o )
[ 5 of 40] Compiling Util             ( src/Util.hs, dist/build/klfc/klfc-tmp/Util.dyn_o )
[ 6 of 40] Compiling Permutation      ( src/Permutation.hs, dist/build/klfc/klfc-tmp/Permutation.dyn_o )
[ 7 of 40] Compiling Layout.Pos       ( src/Layout/Pos.hs, dist/build/klfc/klfc-tmp/Layout/Pos.dyn_o )
[ 8 of 40] Compiling Layout.Mod       ( src/Layout/Mod.hs, dist/build/klfc/klfc-tmp/Layout/Mod.dyn_o )
[ 9 of 40] Compiling Layout.DeadKey   ( src/Layout/DeadKey.hs, dist/build/klfc/klfc-tmp/Layout/DeadKey.dyn_o )
[10 of 40] Compiling PresetDeadKey    ( src/PresetDeadKey.hs, dist/build/klfc/klfc-tmp/PresetDeadKey.dyn_o )
[11 of 40] Compiling Layout.Action    ( src/Layout/Action.hs, dist/build/klfc/klfc-tmp/Layout/Action.dyn_o )
[12 of 40] Compiling Filter           ( src/Filter.hs, dist/build/klfc/klfc-tmp/Filter.dyn_o )
[13 of 40] Compiling FileType         ( src/FileType.hs, dist/build/klfc/klfc-tmp/FileType.dyn_o )
[14 of 40] Compiling WithBar          ( src/WithBar.hs, dist/build/klfc/klfc-tmp/WithBar.dyn_o )
[15 of 40] Compiling WithPlus         ( src/WithPlus.hs, dist/build/klfc/klfc-tmp/WithPlus.dyn_o )

src/WithPlus.hs:7:7: error:
    Ambiguous occurrence ‘singleton’
    It could refer to
       either ‘BasePrelude.singleton’,
              imported from ‘BasePrelude’ at src/WithPlus.hs:12:1-44
              (and originally defined in ‘base-4.15.0.0:Data.OldList’)
           or ‘WithPlus.singleton’, defined at src/WithPlus.hs:32:1
  |
7 |     , singleton
  |       ^^^^^^^^^
cabal: Failed to build keyboard-layout-files-creator-1.5.7. See the build log
above for details.
ghost commented 2 years ago

I will attempt to compile it with the latest 8.x ghc, once I figure out how to use ghcup.

ghost commented 2 years ago

I got ghc 8.10.7 from ghcup, successfully compiled klfc, however now I am running into the missing libffi.so.7 (my system only has libffi.so.8 in /usr/lib) error mentioned in #39

Clarification: I used the master branch (reverted the line 83 changes in utils.hs)

ghost commented 2 years ago

The libffi.so.7 error is not present with the latest releases binary. Klfc works perfectly on my system now. Thank you for developing and maintaining this awesome software package!