I have be trying to build haskell-gi packages in a flake. Things
seemed to be working fine up until today,
There seems to be extra dependencies, so I end up doing things like
gi-gio =
let gi-gio-t =
addPkgconfigDepend osuper.gi-gio super.pcre2;
in addExtraLibraries gi-gio-t [
super.util-linux
super.libselinux
super.libsepol
super.pcre
];
which works.
But suddenly with gi-gdkpixbuf
I get a dependency on libdeflate, which doesn’t have a libdeflate.pc
, so I cant just add it as a dependency. What normally happens is that the depency on libtiff which includes the -ldeflate
in its dependencies. However now pkgconfig seems to wants the file to exist. Is there a way to removePkgconfigDepend
it so that the build driver doesn’t complain and stop the build. There is no reason for the build to fail.
The libtiff
and gdk-pixbuf
packages build fine, and I don’t see any need for all these overrides when I build with ghc-9.2.5, so it seem to be a ghc-9.4.4 issue.
Why is this going on?
1 Like
Do you have a github repo that can reproduce the problem you’re seeing? Ideally just in a single default.nix
file (not using flakes at all)?
barryfm
January 20, 2023, 12:20am
3
I fixed my problem by overlaying the libdeflate
derivation with
one that generated a libdeflate.pc
file.
The issue that bothered me was having toaddExtraLibraries
all the indirect dependencies that previously were handled in ghc-9.4 builds up to a few days ago, and still seem to work with ghc-9.2.
I was just checking that there wasn’t some basic change to the Haskell (or other) infrastructure that I wasn’t aware of.
If I do a:
nix-build '<nixpkgs>' -A pkgs.haskell.packages.ghc925.gi-gdkpixbuf
things run just fine. But doing a:
nix-build '<nixpkgs>' -A pkgs.haskell.packages.ghc944.gi-gdkpixbuf
will error out with:
error: builder for '/nix/store/7nrzad87ajjlark9spab4lhxnbnfy55d-haskell-gi-base-0.26.3.drv' failed with exit code 1;
last 10 log lines:
> Dependency gobject-2.0 >=2.42: using version 2.74.3
> Dependency glib-2.0: using version 2.74.3
> Error: Setup:
> '/nix/store/5cip8xpjb9g10nwyzyslxpck3anc4r4h-pkg-config-wrapper-0.29.2/bin/pkg-config'
> exited with an error:
> Package libpcre2-8 was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libpcre2-8.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libpcre2-8', required by 'glib-2.0', not found
>
For full logs, run 'nix log /nix/store/7nrzad87ajjlark9spab4lhxnbnfy55d-haskell-gi-base-0.26.3.drv'.
error: 1 dependencies of derivation '/nix/store/0ryc3d5zyjqkfcfdqsvsdl2qh7mhzfnm-gi-gdkpixbuf-2.0.29.drv' failed to build
Leading to a long chain of additions seen in my previous post.
Hey @barryfm I’m seeing the same issue. Any chance you could post your resolution?
I wonder if this is caused by
opened 12:22AM - 23 Jan 23 UTC
6.topic: haskell
2.status: wait-for-upstream
0.kind: build failure
### Steps To Reproduce
On unstable (or haskell-updates):
```
nix build .\#has… kell.packages.ghc94.zeromq4-haskell
AWS error 'RequestTimeTooSkewed' (The difference between the request time and the current time is too large.), will retry in 0 ms
note: keeping build directory '/tmp/nix-build-zeromq4-haskell-0.8.0.drv-9'
error: builder for '/nix/store/xrngj1m9gnsibw4hnyy1vi9rq8hdfii0-zeromq4-haskell-0.8.0.drv' failed with exit code 1;
last 40 log lines:
> setupCompilerEnvironmentPhase
> Build with /nix/store/x2vrl5gaixpkb7n4ln5l4yc9jfk67paw-ghc-9.4.2.
> unpacking sources
> unpacking source archive /nix/store/7ky7gw17j54jh2hcb4v12y8m6qpdxddr-zeromq4-haskell-0.8.0.tar.gz
> source root is zeromq4-haskell-0.8.0
> patching sources
> compileBuildDriverPhase
> setupCompileFlags: -package-db=/build/tmp.ndjihHELrA/setup-package.conf.d -j8 +RTS -A64M -RTS -threaded -rtsopts
> [1 of 2] Compiling Main ( Setup.hs, /build/tmp.ndjihHELrA/Main.o )
> [2 of 2] Linking Setup
> configuring
> configureFlags: --verbose --prefix=/nix/store/rm9273r57lrqjlasipjgcfj4q4nxl22z-zeromq4-haskell-0.8.0 --libdir=$prefix/lib/$compiler --libsubdir=$abi/$libname --docdir=/nix/store/yymdz2ks5ym0z1ghfrlj2hj5aqipc72y-zeromq4-haskell-0.8.0-doc/share/doc/zeromq4-haskell-0.8.0 --with-gcc=gcc --package-db=/build/tmp.ndjihHELrA/package.conf.d --ghc-options=-j8 +RTS -A64M -RTS --disable-split-objs --enable-library-profiling --profiling-detail=exported-functions --disable-profiling --enable-shared --disable-coverage --enable-static --disable-executable-dynamic --enable-tests --disable-benchmarks --enable-library-vanilla --disable-library-for-ghci --ghc-option=-split-sections --ghc-options=-haddock --extra-lib-dirs=/nix/store/v94mvmxwak89z8y1ijv1nhzp4j3h9jxm-ncurses-6.3-p20220507/lib --extra-lib-dirs=/nix/store/fynz7l60dnqphimnm6l090pckv5scx7b-libffi-3.4.4/lib --extra-lib-dirs=/nix/store/iqpqnl4fz14xsyfhv6950cxw10yfm04c-gmp-with-cxx-6.2.1/lib --extra-include-dirs=/nix/store/52gssbvmlrbx3vka6j64chihl2a3lmn4-zeromq-4.3.4/include --extra-lib-dirs=/nix/store/52gssbvmlrbx3vka6j64chihl2a3lmn4-zeromq-4.3.4/lib
> Using Parsec parser
> Configuring zeromq4-haskell-0.8.0...
> Dependency async >=2.0 && <3.0: using async-2.2.4
> Dependency base >=3 && <5: using base-4.17.0.0
> Dependency bytestring >=0.10: using bytestring-0.11.3.1
> Dependency containers >=0.5: using containers-0.6.6
> Dependency exceptions >=0.6 && <1.0: using exceptions-0.10.5
> Dependency monad-control >=1.0: using monad-control-1.0.3.1
> Dependency semigroups >=0.8: using semigroups-0.20
> Dependency transformers >=0.3: using transformers-0.5.6.2
> Dependency transformers-base >=0.4: using transformers-base-0.4.6
> Dependency QuickCheck >=2.6: using QuickCheck-2.14.2
> Dependency async: using async-2.2.4
> Dependency base >=3 && <5: using base-4.17.0.0
> Dependency bytestring: using bytestring-0.11.3.1
> Dependency tasty >=0.8: using tasty-1.4.3
> Dependency tasty-hunit >=0.8: using tasty-hunit-0.10.0.3
> Dependency tasty-quickcheck >=0.8: using tasty-quickcheck-0.10.2
> Dependency zeromq4-haskell: using zeromq4-haskell-0.8.0
> Dependency libzmq >=4.0 && <5.0: using version 4.3.4
> Error: Setup:
> '/nix/store/5cip8xpjb9g10nwyzyslxpck3anc4r4h-pkg-config-wrapper-0.29.2/bin/pkg-config'
> exited with an error:
> Package libsodium was not found in the pkg-config search path.
> Perhaps you should add the directory containing `libsodium.pc'
> to the PKG_CONFIG_PATH environment variable
> Package 'libsodium', required by 'libzmq', not found
>
For full logs, run 'nix log /nix/store/xrngj1m9gnsibw4hnyy1vi9rq8hdfii0-zeromq4-haskell-0.8.0.drv'.
```
### Build log
```
log here if short otherwise a link to a gist
```
### Additional context
zeromq got updated with a new dep libsodium [here](https://github.com/NixOS/nixpkgs/pull/128453/files). I tried first adding
I tried first to add to a haskell overlay `zeromq4-haskell = hfinal.lib.addPkgconfigDepend libsodium.dev hprev.zeromq4-haskell ;` to no avail. Moving libsodium to propagatedBuildInputs instead of buildInputs seems to fix it but not sure that's the proper fix ?
### Notify maintainers
<!--
Please @ people who are in the `meta.maintainers` list of the offending package or module.
If in doubt, check `git blame` for whoever last touched something.
-->
### Metadata
nixpkgs 5ed481943351e9fd354aeb557679624224de38d5
I can show you the overlay I use currently to build my packages for ghc94x from nixpkgs-unstable. Its basically a compose.__CabalEagerPkgConfigWorkaround
anything
that shows pkg-config problems.
self: super:
let myghc =
if super.haskell.compiler ? "ghc946" then "ghc946" else
if super.haskell.compiler ? "ghc945" then "ghc945" else
"ghc944";
mypostgresql = (if super ? "postgresql_16"
then super.postgresql_16
else super.postgresql_15);
in
rec {
#myHaskellPackages = let h-srcs = /proj/barry/src/haskell; in
myHaskellPackages = let h-srcs = ../haskell; in
self.haskell.packages.${myghc}.override {
overrides = oself: osuper: with super.haskell.lib;
let fixCabal = compose.__CabalEagerPkgConfigWorkaround;
in rec {
## ListLike checks just takes too long)
#ListLike = dontCheck osuper.ListLike;
## Newer versions
#ghc-lib = osuper.ghc-lib_9_4_4_20221225;
#ghc-lib-parser = osuper.ghc-lib-parser_9_4_4_20221225;
#ghc-lib-parser-ex = osuper.ghc-lib-parser-ex_9_4_0_0;
microlens = osuper.microlens_0_4_13_1;
microlens-ghc = osuper.microlens-ghc_0_4_14_1;
microlens-platform = osuper.microlens-platform_0_4_3_3;
fgl = osuper.fgl_5_8_1_1;
#http-api-data = osuper.http-api-data_0_5_1;
#attoparsec-iso8601 = osuper.attoparsec-iso8601_1_1_0_0;
postgresql-simple = osuper.postgresql-simple_0_6_5;
#hlint = osuper.hlint_3_5;
#ormolu = osuper.ormolu_0_5_3_0;
#stylish-haskell = osuper.stylish-haskell_0_14_4_0;
## Jailbreaks
ShellCheck = dontCheck (doJailbreak osuper.ShellCheck);
Chart = doJailbreak osuper.Chart;
string-qq = doJailbreak osuper.string-qq;
hslua-aeson = doJailbreak osuper.hslua-aeson;
pandoc = doJailbreak osuper.pandoc;
OpenGLRaw = doJailbreak osuper.OpenGLRaw;
## Dependency fixes for ghc-9.4.x
haskell-gi-base = fixCabal osuper.haskell-gi-base;
haskell-gi = fixCabal osuper.haskell-gi;
gi-glib = fixCabal osuper.gi-glib;
gi-gmodule = fixCabal osuper.gi-gmodule;
gi-gobject = fixCabal osuper.gi-gobject;
gi-atk = fixCabal osuper.gi-atk;
gi-harfbuzz = fixCabal osuper.gi-harfbuzz;
gi-gio = fixCabal osuper.gi-gio;
gi-gdkpixbuf = fixCabal osuper.gi-gdkpixbuf;
gi-pango = fixCabal osuper.gi-pango;
gi-gdk = fixCabal osuper.gi-gdk;
gi-gtk = fixCabal osuper.gi-gtk;
gi-cairo = fixCabal osuper.gi-cairo;
gi-cairo-render = fixCabal osuper.gi-cairo-render;
## Standard setup
postgresql-libpq = osuper.postgresql-libpq.override {
postgresql = mypostgresql;
};
## Own code
ecube = osuper.callPackage (h-srcs + /ecube-lib) {};
ecube-apps-cli = osuper.callPackage (h-srcs + /ecube-apps/cli) {};
gi-chart-cairo = osuper.callPackage (h-srcs + /chart-backends/gi/gi-chart-cairo) { inherit (super) cairo; inherit (super) pcre2; };
gi-chart-gtk = osuper.callPackage (h-srcs + /chart-backends/gi/gi-chart-gtk) {};
ecube-apps-gi = osuper.callPackage (h-srcs + /ecube-apps/gi-gtk) {};
ecube-new = osuper.callPackage (h-srcs + /ecube-new) {};
};
};
myHaskellEnv = self.haskell.packages.${myghc}.ghcWithPackages
(haskellPackages: with self.myHaskellPackages; [
## base libraries
base bytestring colour data-default-class
deepseq directory filepath
lens mtl parsec time unix
aeson formatting
## build dependencies
## (so it they get garbage collected and force rebuilds)
hspec path hscolour
## used by programs
Decimal
GLUT
Glob
HTTP
ansi-terminal
cassava
cryptonite
data-ordlist
fsnotify
#hsshellscript ## Broken in ghc943
http-conduit
posix-paths
postgresql-simple
regex-pcre
regex-tdfa
split
sqlite-simple
strict
utility-ht
xdg-basedir
xml
## Trying out (not yet used)
selective
witch
## tools
ShellCheck
alex
c2hs
cabal-install
cabal2nix
happy
hasktags
hlint
hoogle shake
hpack
nix-diff
ormolu
pandoc
## own cli
Chart
ecube
ecube-apps-cli
ecube-new
## haskell-gi
haskell-gi
gi-cairo gi-cairo-render gi-cairo-connector
gi-gdk gi-gtk gi-gtk-hs
## own gtk
gi-chart-gtk gi-chart-cairo
ecube-apps-gi
## Was Seperately installed
#ghcid ## Still doesn't install executable
ghcide
#haskell-language-server
stylish-haskell
]);
};
}
1 Like
Upstream issue for reference: Cabal 3.8 expects `pkg-config --libs --static` to always work. · Issue #8455 · haskell/cabal · GitHub . Cabal would be interested in a fix for this, but seems like no one is working on it at the moment. Would be great to have this fixed for 3.12 at least, it’s too late for 3.10 already…