klfc icon indicating copy to clipboard operation
klfc copied to clipboard

AUR build fails

Open friday opened this issue 5 years ago • 8 comments

I tried building the AUR with yay and with makepkg -si, but it fails, and I'm getting this output in the build phase:

==> Starting build()...
Warning: The update command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-update command
or the legacy v1-update alias as new-style projects will become the default in
the next version of cabal-install. Please file a bug if you cannot replicate a
working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
    cabal update --index-state='2018-10-26T21:37:11Z'
Warning: The install command is a part of the legacy v1 style of cabal usage.

Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Resolving dependencies...
Starting     containers-0.5.11.0
Building     containers-0.5.11.0
Failed to install containers-0.5.11.0
Build log ( /home/albin/.cabal/logs/ghc-8.6.1/containers-0.5.11.0-JCGpMMgDKZFBabcPOY6x1w.log ):
cabal: Entering directory '/tmp/cabal-tmp-32252/containers-0.5.11.0'
Configuring containers-0.5.11.0...
Preprocessing library for containers-0.5.11.0..
Building library for containers-0.5.11.0..
[ 1 of 35] Compiling Utils.Containers.Internal.BitUtil ( Utils/Containers/Internal/BitUtil.hs, dist/build/Utils/Containers/Internal/BitUtil.o )

Utils/Containers/Internal/BitUtil.hs:33:8: error:
    Could not find module ‘Prelude’
    There are files missing in the ‘base-4.12.0.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.
   |
33 | module Utils.Containers.Internal.BitUtil
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Utils/Containers/Internal/BitUtil.hs:41:1: error:
    Could not find module ‘Data.Bits’
    There are files missing in the ‘base-4.12.0.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.
   |
41 | import Data.Bits ((.|.), xor)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Utils/Containers/Internal/BitUtil.hs:43:1: error:
    Could not find module ‘Data.Bits’
    There are files missing in the ‘base-4.12.0.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.
   |
43 | import Data.Bits (popCount, unsafeShiftL, unsafeShiftR)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Utils/Containers/Internal/BitUtil.hs:48:1: error:
    Could not find module ‘Data.Bits’
    There are files missing in the ‘base-4.12.0.0’ package,
    try running 'ghc-pkg check'.
    Use -v to see a list of the files searched for.
   |
48 | import Data.Bits (finiteBitSize)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cabal: Leaving directory '/tmp/cabal-tmp-32252/containers-0.5.11.0'
cabal: Error: some packages failed to install:
containers-0.5.11.0-JCGpMMgDKZFBabcPOY6x1w failed during the building phase.
The exception was:
ExitFailure 1
containers-unicode-symbols-0.3.1.1-LaR6volD3qk9CSSp0HHVJX depends on
containers-unicode-symbols-0.3.1.1 which failed to install.

==> ERROR: A failure occurred in build().
    Aborting...

ghc-pkg check only lists missing html docs and the build log file is the same as the output.

friday avatar Oct 27 '18 09:10 friday

Thanks for the report! They fail for me as well. I will take a look at it.

39aldo39 avatar Oct 31 '18 12:10 39aldo39

I have updated the AUR. It should work now.

39aldo39 avatar Nov 01 '18 20:11 39aldo39

Thank you! The build doesn't fail any more, but the resulting binary doesn't run. It's also is 5,6M rather than the 26M one which can be downloaded here (maybe this is because of using shared objects).

When I run klfc -h I get this:

klfc: error while loading shared libraries: libHSxml-1.3.14-Ew3qY8SQrmLG4scYEQRIVk-ghc8.6.1.so: cannot open shared object file: No such file or directory

Build log:

Writing a default package environment file to
/home/albin/.cache/yay/klfc/src/klfc-abfc7ebd80a33a20caa50d481cfa46183258dda6/cabal.sandbox.config
Creating a new sandbox at
/home/albin/.cache/yay/klfc/src/klfc-abfc7ebd80a33a20caa50d481cfa46183258dda6/.cabal-sandbox
Downloading the latest package list from hackage.haskell.org
To revert to previous state run:
    cabal update --index-state='2018-11-01T22:51:10Z'
Resolving dependencies...
Warning: The following packages are likely to be broken by the reinstalls:
zip-archive-0.3.3
megaparsec-6.5.0
parsec-3.1.13.0
network-uri-2.6.1.0
hackage-security-0.5.3.0
HTTP-4000.3.12
Cabal-2.4.0.1
async-2.2.1
resolv-0.1.1.1
libiserv-8.6.1
ghci-8.6.1
ghc-8.6.1
ghc-boot-8.6.1
Continuing even though the plan contains dangerous reinstalls.
Notice: installing into a sandbox located at
/home/albin/.cache/yay/klfc/src/klfc-abfc7ebd80a33a20caa50d481cfa46183258dda6/.cabal-sandbox
Starting     fail-4.9.0.0
Starting     semigroups-0.18.5
Starting     containers-0.5.11.0
Building     fail-4.9.0.0
Building     semigroups-0.18.5
Building     containers-0.5.11.0
Completed    fail-4.9.0.0
Completed    semigroups-0.18.5
Completed    containers-0.5.11.0
Starting     microlens-ghc-0.4.9.1
Starting     th-abstraction-0.2.8.0
Starting     containers-unicode-symbols-0.3.1.1
Starting     binary-0.8.6.0
Building     microlens-ghc-0.4.9.1
Building     containers-unicode-symbols-0.3.1.1
Building     th-abstraction-0.2.8.0
Building     binary-0.8.6.0
Completed    containers-unicode-symbols-0.3.1.1
Completed    microlens-ghc-0.4.9.1
Completed    th-abstraction-0.2.8.0
Starting     microlens-th-0.4.2.3
Building     microlens-th-0.4.2.3
Completed    microlens-th-0.4.2.3
Completed    binary-0.8.6.0
Starting     text-1.2.3.1
Building     text-1.2.3.1
Completed    text-1.2.3.1
Starting     xml-1.3.14
Starting     chunked-data-0.3.1
Starting     hashable-1.2.7.0
Building     xml-1.3.14
Building     hashable-1.2.7.0
Building     chunked-data-0.3.1
Completed    chunked-data-0.3.1
Completed    hashable-1.2.7.0
Starting     uuid-types-1.0.3
Starting     case-insensitive-1.2.0.11
Starting     scientific-0.3.6.2
Starting     unordered-containers-0.2.9.0
Building     scientific-0.3.6.2
Building     case-insensitive-1.2.0.11
Building     uuid-types-1.0.3
Building     unordered-containers-0.2.9.0
Completed    xml-1.3.14
Completed    case-insensitive-1.2.0.11
Completed    uuid-types-1.0.3
Completed    scientific-0.3.6.2
Starting     megaparsec-7.0.3
Starting     attoparsec-0.13.2.2
Building     megaparsec-7.0.3
Building     attoparsec-0.13.2.2
Completed    unordered-containers-0.2.9.0
Starting     microlens-platform-0.3.10
Building     microlens-platform-0.3.10
Completed    microlens-platform-0.3.10
Completed    megaparsec-7.0.3
Completed    attoparsec-0.13.2.2
Starting     aeson-1.4.1.0
Building     aeson-1.4.1.0
Completed    aeson-1.4.1.0
Resolving dependencies...
Configuring keyboard-layout-files-creator-1.5.3...
Preprocessing executable 'klfc' for keyboard-layout-files-creator-1.5.3..
Building executable 'klfc' for keyboard-layout-files-creator-1.5.3..
[ 1 of 40] Compiling JsonComments     ( src/JsonComments.hs, dist/build/klfc/klfc-tmp/JsonComments.o )
[ 2 of 40] Compiling JsonPretty       ( src/JsonPretty.hs, dist/build/klfc/klfc-tmp/JsonPretty.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.o )
[ 4 of 40] Compiling Stream           ( src/Stream.hs, dist/build/klfc/klfc-tmp/Stream.o )
[ 5 of 40] Compiling Util             ( src/Util.hs, dist/build/klfc/klfc-tmp/Util.o )
[ 6 of 40] Compiling Permutation      ( src/Permutation.hs, dist/build/klfc/klfc-tmp/Permutation.o )
[ 7 of 40] Compiling Layout.Pos       ( src/Layout/Pos.hs, dist/build/klfc/klfc-tmp/Layout/Pos.o )
[ 8 of 40] Compiling Layout.Mod       ( src/Layout/Mod.hs, dist/build/klfc/klfc-tmp/Layout/Mod.o )
[ 9 of 40] Compiling Layout.DeadKey   ( src/Layout/DeadKey.hs, dist/build/klfc/klfc-tmp/Layout/DeadKey.o )
[10 of 40] Compiling PresetDeadKey    ( src/PresetDeadKey.hs, dist/build/klfc/klfc-tmp/PresetDeadKey.o )
[11 of 40] Compiling Layout.Action    ( src/Layout/Action.hs, dist/build/klfc/klfc-tmp/Layout/Action.o )
[12 of 40] Compiling Filter           ( src/Filter.hs, dist/build/klfc/klfc-tmp/Filter.o )
[13 of 40] Compiling FileType         ( src/FileType.hs, dist/build/klfc/klfc-tmp/FileType.o )
[14 of 40] Compiling WithBar          ( src/WithBar.hs, dist/build/klfc/klfc-tmp/WithBar.o )
[15 of 40] Compiling WithPlus         ( src/WithPlus.hs, dist/build/klfc/klfc-tmp/WithPlus.o )
[16 of 40] Compiling Layout.Modifier  ( src/Layout/Modifier.hs, dist/build/klfc/klfc-tmp/Layout/Modifier.o )
[17 of 40] Compiling Layout.ModifierEffect ( src/Layout/ModifierEffect.hs, dist/build/klfc/klfc-tmp/Layout/ModifierEffect.o )
[18 of 40] Compiling Layout.Key       ( src/Layout/Key.hs, dist/build/klfc/klfc-tmp/Layout/Key.o )
[19 of 40] Compiling Layout.Layout    ( src/Layout/Layout.hs, dist/build/klfc/klfc-tmp/Layout/Layout.o )
[20 of 40] Compiling Layout.Types     ( src/Layout/Types.hs, dist/build/klfc/klfc-tmp/Layout/Types.o )
[21 of 40] Compiling PresetLayout     ( src/PresetLayout.hs, dist/build/klfc/klfc-tmp/PresetLayout.o )
[22 of 40] Compiling Lookup.Tmk       ( src/Lookup/Tmk.hs, dist/build/klfc/klfc-tmp/Lookup/Tmk.o )
[23 of 40] Compiling Lookup.MacOS     ( src/Lookup/MacOS.hs, dist/build/klfc/klfc-tmp/Lookup/MacOS.o )
[24 of 40] Compiling Lookup.Linux     ( src/Lookup/Linux.hs, dist/build/klfc/klfc-tmp/Lookup/Linux.o )
[25 of 40] Compiling Tmk              ( src/Tmk.hs, dist/build/klfc/klfc-tmp/Tmk.o )
[26 of 40] Compiling Lookup.Windows   ( src/Lookup/Windows.hs, dist/build/klfc/klfc-tmp/Lookup/Windows.o )
[27 of 40] Compiling PklParse         ( src/PklParse.hs, dist/build/klfc/klfc-tmp/PklParse.o )
[28 of 40] Compiling Pkl              ( src/Pkl.hs, dist/build/klfc/klfc-tmp/Pkl.o )
[29 of 40] Compiling KlcParse         ( src/KlcParse.hs, dist/build/klfc/klfc-tmp/KlcParse.o )
[30 of 40] Compiling Klc              ( src/Klc.hs, dist/build/klfc/klfc-tmp/Klc.o )
[31 of 40] Compiling Keylayout        ( src/Keylayout.hs, dist/build/klfc/klfc-tmp/Keylayout.o )
[32 of 40] Compiling Ahk              ( src/Ahk.hs, dist/build/klfc/klfc-tmp/Ahk.o )
[33 of 40] Compiling Xkb.General      ( src/Xkb/General.hs, dist/build/klfc/klfc-tmp/Xkb/General.o )
[34 of 40] Compiling Xkb.Keycodes     ( src/Xkb/Keycodes.hs, dist/build/klfc/klfc-tmp/Xkb/Keycodes.o )
[35 of 40] Compiling Xkb.Parse        ( src/Xkb/Parse.hs, dist/build/klfc/klfc-tmp/Xkb/Parse.o )
[36 of 40] Compiling Xkb.Types        ( src/Xkb/Types.hs, dist/build/klfc/klfc-tmp/Xkb/Types.o )
[37 of 40] Compiling Xkb.Symbols      ( src/Xkb/Symbols.hs, dist/build/klfc/klfc-tmp/Xkb/Symbols.o )
[38 of 40] Compiling Xkb.XCompose     ( src/Xkb/XCompose.hs, dist/build/klfc/klfc-tmp/Xkb/XCompose.o )
[39 of 40] Compiling Xkb              ( src/Xkb.hs, dist/build/klfc/klfc-tmp/Xkb.o )
[40 of 40] Compiling Main             ( src/Main.hs, dist/build/klfc/klfc-tmp/Main.o )
Linking dist/build/klfc/klfc ..

friday avatar Nov 02 '18 12:11 friday

The resulting binary indeed doesn't run when the build directory is removed. (It does run when it's still there.) Installing the global packages doesn't help either. Even if it would, the Megaparsec package is still at an older version.

A solution would be statically build the binary, but I don't know how to do that with the Arch packages.

39aldo39 avatar Nov 05 '18 15:11 39aldo39

I'm not a Haskell dev and I'm fairly new with Arch (just switch from Mac to Antergos some months ago), so I'm afraid I can't help you much.

One possible solution I've seen other packages use is downloading the binary instead of compiling. Usually those packages have the suffix "-bin". Ex: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=visual-studio-code-bin

Personally this would be better for me since it would avoid the build time, and it'd likely mean less complexity/breakage like this for you to maintain (if you do this instead of the current AUR). It may however be considered a bad praxis or the "wrong solution" or something, and possibly miss optimizations or compatibility for some cpu architectures.

friday avatar Nov 05 '18 16:11 friday

I found some info related to the static linking problem for Arch, but it seems very cumbersome: https://vadosware.io/post/static-binaries-for-haskell-a-convoluted-approach/ https://www.reddit.com/r/haskell/comments/7a1ty3/whats_the_correct_way_to_install_ghc_and_cabal_on/

I created this basic PKGBUILD which just copies the binary from your github release to /usr/bin:

pkgname=klfc-bin
provides=('klfc')
conflicts=('klfc')
pkgver=1.5.3
pkgrel=1
pkgdesc="Tool to create advanced keyboard layouts in various formats (binary version)"
url="https://github.com/39aldo39/klfc"
license=("GPL3")
arch=('x86_64')
source=(https://github.com/39aldo39/klfc/releases/download/v${pkgver}/klfc-linux-amd64-v${pkgver}.tar.xz)
sha256sums=('bc71abe4548ec36b2565f1ff37a21235c76b329fde00b1f463c111b53ddad9e0')

package() {
  mkdir -p "${pkgdir}/usr/bin"
  cp "${srcdir}/klfc" "${pkgdir}/usr/bin/"
}

I could add it to aur.archlinux.org, but I'm not sure I would be a good maintainer. Is this something you would consider adding and maintaining? Perhaps the other arch users @ninrod and @noctuid from #5 has opinions on this?

friday avatar Nov 21 '18 13:11 friday

Thanks for the PKGBUILD! I have added it to the AUR under the name klfc-bin.

39aldo39 avatar Nov 22 '18 18:11 39aldo39

I have a similar problem:

% klfc --version
klfc: error while loading shared libraries: libffi.so.6: cannot open shared object file: No such file or directory
% ldd `which klfc`
	linux-vdso.so.1 (0x00007ffdeebf6000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f12f5c95000)
	librt.so.1 => /usr/lib/librt.so.1 (0x00007f12f5c8a000)
	libutil.so.1 => /usr/lib/libutil.so.1 (0x00007f12f5c85000)
	libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f12f5c7e000)
	libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f12f5c5d000)
	libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f12f5bbd000)
	libatomic.so.1 => /usr/lib/libatomic.so.1 (0x00007f12f5bb1000)
	libffi.so.6 => not found
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f12f59e5000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f12f5e0e000)

I installed klfc-bin from AUR.

kindaro avatar Jul 16 '21 12:07 kindaro