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

[WIP] Fix taffybar #40186

Closed
wants to merge 5 commits into from
Closed

[WIP] Fix taffybar #40186

wants to merge 5 commits into from

Conversation

abbradar
Copy link
Member

@abbradar abbradar commented May 8, 2018

Motivation for this change

Fix taffybar.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

This makes all the dependencies for taffybar build but taffybar itself fails with:

gcc: error trying to exec '/nix/store/ng5kbr6kmh979qaachifbsbblydrcmqc-gcc-7.3.0/libexec/gcc/x86_64-unknown-linux-gnu/7.3.0/collect2': execv: Argument list too long

Not sure how to fix this -- there may be duplicated arguments in configureFlags for Cabal, should we filter them somehow? @peti, any ideas?

For testing one can skip 76f629e and 7c698dd -- those are mass rebuild changes.

@@ -214,6 +214,10 @@ stdenv.mkDerivation ({

LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.

# XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042.
LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x: x != null) systemBuildInputs);
# ^^^ Internally uses `getOutput "lib"` (equiv. to getLib)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment is pointing out the definition of the function or is it something special?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pointing out the definition -- I copied that from stack-builder.nix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sketched out by adding this. is ghci really needed? The rest looks good.

@abbradar
Copy link
Member Author

abbradar commented May 8, 2018

@Ericson2314 I've noticed that hooks are executed several times for propagated build inputs in some cases. For example:

$ nix-shell -A gtk3
(shell) $ echo $PKG_CONFIG_PATH | grep -o /nix/store/fg6asqlsnc0wnv9fj6zp29w9aadbm6ir-libffi-3.2.1-dev/lib/pkgconfig | wc -l
4

From a quick look at our source code this shouldn't happen because we keep track of traversed packages. pkgconfig setup hook looks fairly simple. Any ideas (sorry for asking, you was the first I had in mind whom to ask modern stdenv stuff :D)?

@Ericson2314
Copy link
Member

@abbradar yes its because 469fd89 and some custom setup script with which makes various things two different types of deps. We really want to get revert that workaround but that would break packages with miscategorized deps.

@abbradar
Copy link
Member Author

abbradar commented May 8, 2018 via email

@colonelpanic8
Copy link
Contributor

any progress on the gcc error?

@abbradar
Copy link
Member Author

abbradar commented May 8, 2018

@IvanMalison I don't see a good solution now; this could either be fixed in stdenv (removing duplication), in cc-wrapper (adding support for argument files) or maybe somehow in Cabal. The first way is, if I understood @Ericson2314, problematic; the second is doable but still constitutes a mass rebuild. I'm not sure what could we try to do in Cabal.

@Ericson2314
Copy link
Member

Ah doctests. Good use. I'd maybe mention that (as an example) explicitly. Yeah I want to teach *-wrapper to use response files, so that's a good approach. Cabal may in fact use them, but the wrappers need to unpack to use their black magic.

@Ericson2314
Copy link
Member

For the duplication, add crossConfig = true; to generic builder. I realize that looks super weird, I'll clean up in mass rebuild very soon.

@@ -214,6 +214,10 @@ stdenv.mkDerivation ({

LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.

# XXX: workaround for https://ghc.haskell.org/trac/ghc/ticket/11042.
LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x: x != null) systemBuildInputs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a bad idea to set LD_LIBRARY_PATHS in the generic builder. The haskell-gi build is supposed to fail, honestly, because upstream calls their doctest suite with incorrect flags. I don't want us to add kludges to our code so that their broken code can succeed. The proper solution is to fix the haskell-gi build. I've committed 3e05301c94d72979da3c5f304196c7dd01f76a15 to accomplish that until a new release comes out.

@abbradar
Copy link
Member Author

abbradar commented May 9, 2018 via email

@peti
Copy link
Member

peti commented May 9, 2018

Why is this used in Stack builder though?

I have no clue what that stack builder is doing. :-/

@@ -144,6 +144,9 @@ self: super: builtins.intersectAttrs super {
gtk = disableHardening (addPkgconfigDepend (addBuildTool super.gtk self.gtk2hs-buildtools) pkgs.gtk2) ["fortify"];
gtksourceview2 = addPkgconfigDepend super.gtksourceview2 pkgs.gtk2;
gtk-traymanager = addPkgconfigDepend super.gtk-traymanager pkgs.gtk3;
gi-gdkx11 = addPkgconfigDepend super.gi-gdkx11 pkgs.gtk3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this override is no longer necessary due to NixOS/cabal2nix@2923434. gi-gdkx11 compiles fine in haskell-updates without this override.

@@ -144,6 +144,9 @@ self: super: builtins.intersectAttrs super {
gtk = disableHardening (addPkgconfigDepend (addBuildTool super.gtk self.gtk2hs-buildtools) pkgs.gtk2) ["fortify"];
gtksourceview2 = addPkgconfigDepend super.gtksourceview2 pkgs.gtk2;
gtk-traymanager = addPkgconfigDepend super.gtk-traymanager pkgs.gtk3;
gi-gdkx11 = addPkgconfigDepend super.gi-gdkx11 pkgs.gtk3;
gi-dbusmenu = super.gi-dbusmenu.override { dbusmenu-glib = pkgs.libdbusmenu-glib; };
gi-dbusmenugtk3 = super.gi-dbusmenugtk3.override { dbusmenu-gtk3 = pkgs.libdbusmenu-gtk3; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two overrides should be unnecessary after NixOS/cabal2nix@d8bc043.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think NixOS/cabal2nix#353 is also needed, unless upstream is an even better place.

@abbradar
Copy link
Member Author

abbradar commented May 9, 2018

@peti Nice! That leaves us only with a libdbusmenu GTK propagation patch and some way to fix taffybar. I'm testing response files patch for cc-wrapper now, if that doesn't help I'll try crossConfig = true too. @Ericson2314 what is this flag? I mean, what are the other possible consequences if we enable it for the whole Haskell builder?

@Ericson2314
Copy link
Member

@abbradar see 469fd89 and the new conditions based on crossConfig. It was just a convenient way to detect cross compilation from bash. Longer term I want to rename those to use some new var like strictDeps and define strictDeps = buildPlatform != hostPlatform; in nixpkgs. So tl;dr don't worry about crossConfig other than the usages in that commit.

@abbradar
Copy link
Member Author

abbradar commented May 10, 2018

It seems response files don't fix this because gcc itself calls binaries with too long arguments:

using a response file
gcc: error trying to exec '/nix/store/1c65cfy34vqgkfavd0hlvcsyj1qdax04-gcc-7.3.0/libexec/gcc/x86_64-unknown-linux-gnu/7.3.0/collect2': execv: Argument list too long

So... what do we do from here?

EDIT: reading gcc's source code -- there's no visible way to force it to pass arguments to its child processes via a file too.

@srhb
Copy link
Contributor

srhb commented May 11, 2018

@abbradar fwiw, that error message can be a little misleading, if you didn't know: Everything in the environment is counted as well as the command line arguments. If the content of the variables was just stuck in response files but the variables themselves never cleared, they still count towards the limit.

@abbradar
Copy link
Member Author

abbradar commented May 11, 2018 via email

@srhb
Copy link
Contributor

srhb commented May 11, 2018

Yes, it does seem hacky. It's a fundamental builder problem if we take up this much space in the environment, though...

@Ericson2314
Copy link
Member

#40539 means one can do strictDeps = true, which is a slightly nicer solution to the too-many-deps problem.

@Ericson2314
Copy link
Member

Post-#40529 do strictDeps = true; instead of crossConfig = true;.

@colonelpanic8
Copy link
Contributor

@abbradar Are we still stuck?

@colonelpanic8
Copy link
Contributor

@Ericson2314 I'm running in to this issue with stack builds of taffybar as well (I have the nix integration enabled). How would I set strictDeps = true; for this case?

Copy link
Contributor

@puffnfresh puffnfresh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either NixOS/cabal2nix#353 or haskell-gi/haskell-gi#172 are better places for these changes.

@@ -144,6 +144,9 @@ self: super: builtins.intersectAttrs super {
gtk = disableHardening (addPkgconfigDepend (addBuildTool super.gtk self.gtk2hs-buildtools) pkgs.gtk2) ["fortify"];
gtksourceview2 = addPkgconfigDepend super.gtksourceview2 pkgs.gtk2;
gtk-traymanager = addPkgconfigDepend super.gtk-traymanager pkgs.gtk3;
gi-gdkx11 = addPkgconfigDepend super.gi-gdkx11 pkgs.gtk3;
gi-dbusmenu = super.gi-dbusmenu.override { dbusmenu-glib = pkgs.libdbusmenu-glib; };
gi-dbusmenugtk3 = super.gi-dbusmenugtk3.override { dbusmenu-gtk3 = pkgs.libdbusmenu-gtk3; };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think NixOS/cabal2nix#353 is also needed, unless upstream is an even better place.

@colonelpanic8
Copy link
Contributor

@abbradar I believe that you should be able to fully compile taffybar-2.1.2 with this pull request because I have removed all hsc files. The gcc call with too many arguments was occuring in this call, (cabal actually seems to properly handle deduplicating these flags AFAICT).

Can you verify?

@glglwty
Copy link

glglwty commented Jul 11, 2018

Is this still an issue? I've been using taffybar from 18.03 for a while and just discovered that taffybar works in nixos-unstable channel without this patch.

@puffnfresh
Copy link
Contributor

Yeah, I think it's fine now @glglwty

@abbradar
Copy link
Member Author

Let's close it; it's stale now.

@abbradar abbradar closed this May 30, 2019
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.

None yet

8 participants