Skip to content

Instantly share code, notes, and snippets.

@wjt
Created August 14, 2020 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wjt/41606d4d375a654259a7ff53d93f7220 to your computer and use it in GitHub Desktop.
Save wjt/41606d4d375a654259a7ff53d93f7220 to your computer and use it in GitHub Desktop.

cabal-flatpak notes

Without --cabal-install

In the default module-at-a-time mode, the build fails as follows:

$ flatpak-builder --install --user --force-clean _app flatpak/org.freedesktop.Bustle.json 
Emptying app dir '_app'
Downloading sources
Starting build of org.freedesktop.Bustle
Cache hit for ghc-8.6.5-x86_64, skipping build
Cache hit for libpcap, skipping build
Cache hit for help2man, skipping build
Cache hit for array, skipping build
Cache hit for deepseq, skipping build
Cache miss, checking out last cache hit
========================================================================
Building module bytestring in /home/wjt/src/bustle_misc/.flatpak-builder/build/bytestring-2
========================================================================
Running: echo '#! /usr/bin/env runhaskell' >Setup.txt
Running: echo '> import Distribution.Simple' >>Setup.txt
Running: echo '> main = defaultMain' >>Setup.txt
Running: ln -s Setup.txt Setup.lhs || true
Running: runhaskell Setup configure --prefix=/app
/app/lib/ghc-8.6.5/bin/ghc: /app/lib/libtinfo.so.5: no version information available (required by /app/lib/ghc-8.6.5/bin/../haskeline-0.7.4.3/libHShaskeline-0.7.4.3-ghc8.6.5.so)
/app/lib/ghc-8.6.5/bin/ghc: /app/lib/libtinfo.so.5: no version information available (required by /app/lib/ghc-8.6.5/bin/../ghc-8.6.5/libHSghc-8.6.5-ghc8.6.5.so)
/app/lib/ghc-8.6.5/bin/ghc: /app/lib/libtinfo.so.5: no version information available (required by /app/lib/ghc-8.6.5/bin/../terminfo-0.4.1.2/libHSterminfo-0.4.1.2-ghc8.6.5.so)

Setup.hs:1:1: error:
    Could not load module ‘Distribution.Simple’
    It is a member of the package ‘Cabal-2.4.0.1’
    which is unusable due to missing dependencies:
      binary-0.8.6.0 bytestring-0.10.8.2 containers-0.6.0.1 deepseq-1.4.4.0 directory-1.3.3.0 parsec-3.1.13.0 pretty-1.1.3.6 process-1.6.5.0 text-1.2.3.1 time-1.8.0.2 unix-2.7.2.2
    Use -v to see a list of the files searched for.
  |
1 | import Distribution.Simple
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^

It appears the modules are not listed in the correct order.

Actually I think this may be caused by the issue below...

Packages likely to be broken by reinstalls

Adding --cabal-install yields a build which fails as follows:

Running: cabal --config-file=.cabal/config install --offline --prefix=/app array-0.5.4.0.tar.gz deepseq-1.4.4.0.tar.gz bytestring-0.10.10.1.tar.gz containers-0.5.11.0.tar.gz binary-0.8.8.0.tar.gz filepath-1.4.2.1.tar.gz time-1.9.3.tar.gz unix-2.7.2.2.tar.gz directory-1.3.6.1.tar.gz transformers-0.5.6.2.tar.gz mtl-2.2.2.tar.gz text-1.2.3.1.tar.gz parsec-3.1.14.0.tar.gz pretty-1.1.3.6.tar.gz process-1.6.10.0.tar.gz Cabal-2.4.1.0.tar.gz hashable-1.3.0.0.tar.gz primitive-0.7.1.0.tar.gz vector-0.12.1.2.tar.gz hashtables-1.2.3.4.tar.gz splitmix-0.1.tar.gz random-1.2.0.tar.gz gtk2hs-buildtools-0.13.8.0.tar.gz utf8-string-1.0.1.1.tar.gz cairo-0.13.8.1.tar.gz cereal-0.5.8.1.tar.gz xml-types-0.3.8.tar.gz libxml-sax-0.7.5.tar.gz network-2.8.0.1.tar.gz dbus-0.10.15.tar.gz glib-0.13.8.1.tar.gz gio-0.13.8.1.tar.gz pango-0.13.8.1.tar.gz gtk3-0.15.5.tar.gz pcap-0.4.5.2.tar.gz bustle-0.7.5.tar.gz
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

/app/lib/ghc-8.6.5/bin/ghc: /app/lib/libtinfo.so.5: no version information available (required by /app/lib/ghc-8.6.5/bin/../haskeline-0.7.4.3/libHShaskeline-0.7.4.3-ghc8.6.5.so)
/app/lib/ghc-8.6.5/bin/ghc: /app/lib/libtinfo.so.5: no version information available (required by /app/lib/ghc-8.6.5/bin/../ghc-8.6.5/libHSghc-8.6.5-ghc8.6.5.so)
/app/lib/ghc-8.6.5/bin/ghc: /app/lib/libtinfo.so.5: no version information available (required by /app/lib/ghc-8.6.5/bin/../terminfo-0.4.1.2/libHSterminfo-0.4.1.2-ghc8.6.5.so)
Warning: No remote package servers have been specified. Usually you would have
one specified in the config file.
Resolving dependencies...
In order, the following would be installed:
array-0.5.4.0 (via: gtk3-0.15.5 pango-0.13.8.1 gio-0.13.8.1 cairo-0.13.8.1
gtk2hs-buildtools-0.13.8.0 Cabal-2.4.1.0 text-1.2.3.1 binary-0.8.8.0
cereal-0.5.8.1 containers-0.5.11.0 deepseq-1.4.4.0) (new version)
filepath-1.4.2.1 (via: bustle-0.7.5 bustle-0.7.5 pango-0.13.8.1
gtk2hs-buildtools-0.13.8.0 Cabal-2.4.1.0 process-1.6.10.0 directory-1.3.6.1)
(reinstall)
transformers-0.5.6.2 (via: dbus-0.10.15 Cabal-2.4.1.0 primitive-0.7.1.0
mtl-2.2.2) (reinstall)
deepseq-1.4.4.0 (via: dbus-0.10.15 Cabal-2.4.1.0 hashable-1.3.0.0
xml-types-0.3.8 process-1.6.10.0 text-1.2.3.1 random-1.2.0 vector-0.12.1.2
splitmix-0.1 bytestring-0.10.10.1 containers-0.5.11.0 pretty-1.1.3.6
primitive-0.7.1.0 time-1.9.3) (reinstall) (changes: array-0.5.3.0 removed)
mtl-2.2.2 (via: bustle-0.7.5 gtk3-0.15.5 pango-0.13.8.1 gio-0.13.8.1
cairo-0.13.8.1 Cabal-2.4.1.0 parsec-3.1.14.0 random-1.2.0) (reinstall)
(changes: transformers-0.5.6.2 removed)
time-1.9.3 (via: bustle-0.7.5 Cabal-2.4.1.0 pcap-0.4.5.2 directory-1.3.6.1
unix-2.7.2.2 splitmix-0.1) (new version)
primitive-0.7.1.0 (via: hashtables-1.2.3.4 vector-0.12.1.2) (new package)
pretty-1.1.3.6 (via: pango-0.13.8.1 gtk2hs-buildtools-0.13.8.0 Cabal-2.4.1.0)
(reinstall) (changes: deepseq-1.4.4.0 removed)
containers-0.5.11.0 (via: bustle-0.7.5 gtk3-0.15.5 pango-0.13.8.1 gio-0.13.8.1
glib-0.13.8.1 gtk2hs-buildtools-0.13.8.0 dbus-0.10.15 Cabal-2.4.1.0
binary-0.8.8.0 cereal-0.5.8.1) (new version)
bytestring-0.10.10.1 (via: bustle-0.7.5 gtk3-0.15.5 gio-0.13.8.1
cairo-0.13.8.1 glib-0.13.8.1 dbus-0.10.15 Cabal-2.4.1.0 libxml-sax-0.7.5
hashable-1.3.0.0 parsec-3.1.14.0 pcap-0.4.5.2 text-1.2.3.1 network-2.8.0.1
random-1.2.0 binary-0.8.8.0 cereal-0.5.8.1 unix-2.7.2.2 utf8-string-1.0.1.1)
(new version)
splitmix-0.1 (via: random-1.2.0) (new package)
vector-0.12.1.2 (via: dbus-0.10.15 hashtables-1.2.3.4) (new package)
utf8-string-1.0.1.1 (via: cairo-0.13.8.1 glib-0.13.8.1) (new package)
unix-2.7.2.2 (via: dbus-0.10.15 Cabal-2.4.1.0 process-1.6.10.0
directory-1.3.6.1 network-2.8.0.1) (reinstall) (changes: bytestring-0.10.8.2
removed, time-1.8.0.2 removed)
cereal-0.5.8.1 (via: dbus-0.10.15) (new package)
binary-0.8.8.0 (via: Cabal-2.4.1.0 text-1.2.3.1) (new version)
random-1.2.0 (via: gtk2hs-buildtools-0.13.8.0 dbus-0.10.15) (new package)
network-2.8.0.1 (via: dbus-0.10.15 pcap-0.4.5.2) (new package)
directory-1.3.6.1 (via: bustle-0.7.5 bustle-0.7.5 pango-0.13.8.1
gtk2hs-buildtools-0.13.8.0 Cabal-2.4.1.0 process-1.6.10.0) (new version)
text-1.2.3.1 (via: bustle-0.7.5 gtk3-0.15.5 pango-0.13.8.1 cairo-0.13.8.1
glib-0.13.8.1 dbus-0.10.15 Cabal-2.4.1.0 libxml-sax-0.7.5 hashable-1.3.0.0
parsec-3.1.14.0 xml-types-0.3.8) (reinstall) (changes: array-0.5.3.0 removed,
binary-0.8.6.0 removed, bytestring-0.10.8.2 removed, deepseq-1.4.4.0 removed)
pcap-0.4.5.2 (via: bustle-0.7.5) (new package)
process-1.6.10.0 (via: bustle-0.7.5 bustle-0.7.5 pango-0.13.8.1
gtk2hs-buildtools-0.13.8.0 Cabal-2.4.1.0) (new version)
xml-types-0.3.8 (via: dbus-0.10.15 libxml-sax-0.7.5) (new package)
parsec-3.1.14.0 (via: dbus-0.10.15 Cabal-2.4.1.0) (new version)
hashable-1.3.0.0 (via: hashtables-1.2.3.4) (new package)
libxml-sax-0.7.5 (via: dbus-0.10.15) (new package)
Cabal-2.4.1.0 (via: bustle-0.7.5 gtk3-0.15.5 pango-0.13.8.1 gio-0.13.8.1
cairo-0.13.8.1 glib-0.13.8.1 gtk2hs-buildtools-0.13.8.0) (new version)
hashtables-1.2.3.4 (via: gtk2hs-buildtools-0.13.8.0) (new package)
dbus-0.10.15 (via: bustle-0.7.5) (new package)
gtk2hs-buildtools-0.13.8.0 (via: gtk3-0.15.5 pango-0.13.8.1 gio-0.13.8.1
cairo-0.13.8.1 glib-0.13.8.1) (new package)
glib-0.13.8.1 (via: bustle-0.7.5 gtk3-0.15.5 pango-0.13.8.1 gio-0.13.8.1) (new
package)
cairo-0.13.8.1 (via: bustle-0.7.5 gtk3-0.15.5 pango-0.13.8.1) (new package)
gio-0.13.8.1 (via: bustle-0.7.5 gtk3-0.15.5) (new package)
pango-0.13.8.1 (via: bustle-0.7.5 gtk3-0.15.5) (new package)
gtk3-0.15.5 (via: bustle-0.7.5) (new package)
bustle-0.7.5 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
process-1.6.5.0
haskeline-0.7.4.3
ghc-8.6.5
Cabal-2.4.0.1
hpc-0.6.0.3
ghci-8.6.5
libiserv-8.6.3
ghc-boot-8.6.5
directory-1.3.3.0
parsec-3.1.13.0
time-1.8.0.2
template-haskell-2.14.0.0
containers-0.6.0.1
binary-0.8.6.0
bytestring-0.10.8.2
ghc-compact-0.1.0.0
Use --force-reinstalls if you want to install anyway.

It is not obvious to me why these are being reinstalled. Anyway, I added --force-reinstalls and soldiered on...

After sleeping on it, I have a theory. I run cabal new-build --dry-run on a Fedora machine. It has slightly different versions of the base modules to the Flatpak build environment. It would be more correct to build up to ghc + cabal-install, then plan the install there.

Yes, I tried generating the plan from within the appropriate step of the Flatpak build and it generated a much simpler plan:

$ flatpak-builder --install --user --force-clean _app flatpak/org.freedesktop.Bustle.json  --stop-at=libpcap
$ flatpak-builder --run _app flatpak/org.freedesktop.Bustle.json  cabal new-build --dry-run --disable-tests --disable-benchmarks --flags=-hgettext
Build profile: -w ghc-8.6.5 -O1
In order, the following would be built (use -v for more details):
 - alex-3.2.5 (exe:alex) (requires build)
 - happy-1.19.12 (exe:happy) (requires download & build)
 - hashable-1.3.0.0 (lib) (requires download & build)
 - primitive-0.7.1.0 (lib) (requires download & build)
 - splitmix-0.1 (lib) (requires download & build)
 - utf8-string-1.0.1.1 (lib:utf8-string) (requires build)
 - vector-0.12.1.2 (lib) (requires download & build)
 - random-1.2.0 (lib) (requires download & build)
 - hashtables-1.2.3.4 (lib) (requires download & build)
 - gtk2hs-buildtools-0.13.8.0 (lib) (requires download & build)
 - glib-0.13.8.1 (lib:glib) (requires download & build)
 - cairo-0.13.8.1 (lib:cairo) (requires download & build)
 - gio-0.13.8.1 (lib:gio) (requires download & build)
 - pango-0.13.8.1 (lib:pango) (requires download & build)
 - gtk3-0.15.5 (lib:gtk3) (requires download & build)
 - bustle-0.7.5.1 (exe:bustle) (first run)

--extra-include-dirs

config.status: creating pcap.buildinfo
config.status: creating include/pcapconfig.h
cabal: Missing dependency on a foreign library:
* Missing (or bad) C library: pcap
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.

Failed to install pcap-0.4.5.2

I don't really care about this one since I've eliminated this dependency. :-) I added --extra-include-dirs=/app/include --extra-lib-dirs=/app/lib and I suggest that these are always appropriate to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment