Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskell.packages.ghc94: package builds fail if Requires.private in required pc file are not available in the build environment #212192

Open
teto opened this issue Jan 23, 2023 · 6 comments
Labels
0.kind: build failure 2.status: wait-for-upstream Waiting for upstream fix (or their other action). 6.topic: haskell

Comments

@teto
Copy link
Member

teto commented Jan 23, 2023

Steps To Reproduce

On unstable (or haskell-updates):

nix build .\#haskell.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. 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

Metadata

nixpkgs 5ed4819

@cdepillabout
Copy link
Member

cdepillabout commented Jan 23, 2023

At some point, someone had posted about having to add a bunch of addPkgconfigDepend when building the haskell-gi family of libraries with ghc-9.4. As far as I know, no one ever figured out what was wrong, or why it is required on ghc-9.4, and not ghc-9.2.

(edit: after a little searching, I think I was thinking of #205814)

I just took a look, and it appears that zeromq4-haskell builds fine with ghc-9.2.

If you're able to look into this, and figure out why zeromq4-haskell builds fine on ghc-9.2 and not ghc-9.4, it would be very helpful.

@sternenseemann
Copy link
Member

This is likely due to haskell/cabal#8455 or haskell/cabal#8494.

Basically Cabal unnecessarily invokes pkg-config in a way that it looks into Requires.private which is only necessary for static linking. Under normal operation the libraries in there are not available in the build environment for purity reasons.

You can possibly work around this problem by overriding the Cabal version used for building Setup.hs.

@sternenseemann sternenseemann added the 2.status: wait-for-upstream Waiting for upstream fix (or their other action). label Jan 25, 2023
@sternenseemann sternenseemann changed the title nix build .\#haskell.packages.ghc94.zeromq4-haskell => Package libsodium was not found in the pkg-config search path haskell.packages.ghc94: package builds fail if Requires.private in required pc file are not available in the build environment Jan 25, 2023
@cdepillabout
Copy link
Member

@teto sterni created a workaround for this issue in #214446. Do you want to send a PR for these packages using this new __CabalEagerPkgConfigWorkaround function?

@Et7f3
Copy link
Contributor

Et7f3 commented May 1, 2023

I encounter this error while packaging new rpm:

graph LR;
  rpm --> selinux
  selinux -.-> libpcre & libsepol
Loading

Under normal operation the libraries in there are not available in the build environment for purity reasons.

isn't a good use case for propagatedBuildInputs ?

@sternenseemann
Copy link
Member

isn't a good use case for propagatedBuildInputs ?

No. The dependency should not need to be propagated when linking dynamically, thus we don't—helping purity. When linking statically, we do propagate the dependency closure, but only then.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/haskell-ghc-9-4-4-flake-extra-dependencies/24777/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: build failure 2.status: wait-for-upstream Waiting for upstream fix (or their other action). 6.topic: haskell
Development

No branches or pull requests

5 participants