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

gi-graphene: fix dependency on graphene #262103

Closed
wants to merge 1 commit into from

Conversation

bgamari
Copy link
Contributor

@bgamari bgamari commented Oct 19, 2023

Description of changes

Here we add the necessary dependency of gi-graphene on the graphene package.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@bgamari
Copy link
Contributor Author

bgamari commented Oct 19, 2023

I cannot figure out for the life of me how to test this. Specifically, it's quite unclear how to regenerate pkgs/development/haskell-modules/hackage-packages.nix without updating the entire Hackage snapshot

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Oct 19, 2023
@sternenseemann
Copy link
Member

Can you drop the all-cabal-hashes update? It should be irrelevant, but would break package set regeneration.

@sternenseemann
Copy link
Member

I cannot figure out for the life of me how to test this. Specifically, it's quite unclear how to regenerate pkgs/development/haskell-modules/hackage-packages.nix without updating the entire Hackage snapshot

Drop the all-cabal-hashes commit and run ./maintainers/scripts/haskell/regenerate-hackage-packages.sh.

Here we add the necessary dependency of gi-graphene on the graphene
package.
@bgamari
Copy link
Contributor Author

bgamari commented Oct 22, 2023

I've dropped the spurious changes. Sadly, however, I am still unable to build gi-gtk_4_0_7 with this branch:

nix-repl> :b legacyPackages.x86_64-linux.haskellPackages.gi-gdk_4_0_7
error: builder for '/nix/store/iaxjyz0arghym4gayyxkx5r52fnpqi63-gi-gdk-4.0.7.drv' failed with exit code 1;
       last 10 log lines:
...
       For full logs, run 'nix log /nix/store/iaxjyz0arghym4gayyxkx5r52fnpqi63-gi-gdk-4.0.7.drv'.
$ nix log /nix/store/kv2zmqdr1a6wbxch8hxjf9a1rxwqs3r9-gi-gdk-4.0.7.drv | tail -n 15
Using tar found on system at:
/nix/store/89s3w7b4g78989kpzc7sy4phv0nqfira-gnutar-1.35/bin/tar
No uhc found
Error: Setup: Missing dependencies on foreign libraries:
* Missing (or bad) C libraries: gtk-4, pangocairo-1.0, pango-1.0, harfbuzz,
gdk_pixbuf-2.0, cairo-gobject, cairo, graphene-1.0, gio-2.0, gobject-2.0,
glib-2.0
This problem can usually be solved by installing the system packages that
provide these libraries (you may need the "-dev" versions). If the libraries
are already installed but in a non-standard location then you can use the
flags --extra-include-dirs= and --extra-lib-dirs= to specify where they are.If
the library files do 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.

I am at quite a loss.

@cdepillabout
Copy link
Member

I sent in part of the fix for gi-graphene in NixOS/cabal2nix#609.

@cdepillabout
Copy link
Member

cdepillabout commented Nov 3, 2023

@bgamari I marked gi-graphene as unbroken in 8a8ec37, which should be included in #262645.

However, it looks like your goal is to actually build gi-gtk-4. I think you'd need a bunch of overrides to do this (so that all the transitive Gnome deps are also on the new 4.* versions). It looks like you were failing on gi-gdk-4. When I try to build gi-gdk-4 on the latest state of haskell-updates without any specific overrides, I get the dreaded failure:

$ git rev-parse HEAD
8a8ec371fe6bd092d180e12a0112a37448b4cb30
$ nix-build -A haskellPackages.gi-gdk_4_0_7
this derivation will be built:
  /nix/store/sc7d83d14a9zy3yh901dhsxzf4y468y4-gi-gdk-4.0.7.drv
building '/nix/store/sc7d83d14a9zy3yh901dhsxzf4y468y4-gi-gdk-4.0.7.drv'...
setupCompilerEnvironmentPhase
Build with /nix/store/z1hnp331svvqhkq9kc9yp5xkp0yqvs3q-ghc-9.4.7.
unpacking sources
unpacking source archive /nix/store/ki6xi1knjqdycyqg9wf2ariz3fm3y00r-gi-gdk-4.0.7.tar.gz
source root is gi-gdk-4.0.7
setting SOURCE_DATE_EPOCH to timestamp 1000000000 of file gi-gdk-4.0.7/stack.yaml
patching sources
compileBuildDriverPhase
setupCompileFlags: -package-db=/build/tmp.T6d2BbrBJo/setup-package.conf.d -j8 +RTS -A64M -RTS -threaded -rtsopts
[1 of 2] Compiling Main             ( Setup.hs, /build/tmp.T6d2BbrBJo/Main.o )
[2 of 2] Linking Setup
gcc: fatal error: cannot execute ‘/nix/store/0b9bsznqs6pdg42dxcwvrlmarjn2p6a1-gcc-12.3.0/libexec/gcc/x86_64-unknown-linux-gnu/12.3.0/collect2’: execv: Argument list too long
compilation terminated.
ghc: `cc' failed in phase `Linker'. (Exit code: 1)

There is a lot more written about this error execv: Argument list too long here: #41340

@traleig1
Copy link

I'm out of my league here, but on the off-chance this is of any help - I ran into both "missing dependencies" and "arguments too long" while trying to build a gi-gtk-4 app on nixos-unstable. Poking around in the dark, I managed to get through the build and run the app using gi-graphene-1.0.5 with some overrides and strictDeps, as mentioned in #41340:

overlay = final: prev: let
  gtkDeps = [
    final.graphene final.gdk-pixbuf final.gtk4
    final.pcre final.pcre2
    final.util-linux.dev final.libselinux final.libsepol
    final.fribidi final.libthai final.libdatrie final.xorg.libXdmcp
  ];
in {
  haskell = prev.haskell // {
    packageOverrides = hfinal: hprev:
      prev.haskell.packageOverrides hfinal hprev // {
        gi-graphene = (hfinal.callHackage "gi-graphene" "1.0.5" {
          graphene-gobject = final.graphene;
        }).overrideAttrs (oldAttrs: { strictDeps = true; });
        gi-gsk = (hfinal.callHackage "gi-gsk" "4.0.7" { }).overrideAttrs (oldAttrs: { strictDeps = true; buildInputs = gtkDeps; });
        gi-gdk = (hfinal.callHackage "gi-gdk" "4.0.7" { }).overrideAttrs (oldAttrs: { strictDeps = true; buildInputs = gtkDeps; });
        gi-gtk = (hfinal.callHackage "gi-gtk" "4.0.8" { }).overrideAttrs (oldAttrs: { strictDeps = true; buildInputs = gtkDeps; });
        "${name}" = hfinal.callCabal2nix name ./. { };
      };
  };
  "${name}" = final.haskell.lib.compose.justStaticExecutables final.haskellPackages.${name};
};

Haven't done much but draw some pixels to the screen, so no idea if it'll break somewhere else at runtime, but so far it hasn't complained.

@sternenseemann
Copy link
Member

This was resolved in cabal2nix.

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

Successfully merging this pull request may close these issues.

4 participants