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

cpython: add separateDebugInfo v2 #110893

Merged
merged 3 commits into from Sep 13, 2021
Merged

Conversation

risicle
Copy link
Contributor

@risicle risicle commented Jan 26, 2021

Motivation for this change

This is my second attempt at #93083 which had to be reverted due to the increased size of libpython*.a. This was because separating debug info doesn't work with static libraries and so it just gets left in place. My fairly simple solution here is to just explicitly unconditionally strip it in postInstall.

Also I note that this is only for py3, because cpython2 has been split out to a separate derivation. It's similar enough though and I could add this there too if things go well with py3.

Tested on master (before I rebased to staging) on non-nixos linux, nixos & macos 10.14 (all x86_64). Obviously, I have not performed a full rebuild.

Seeing as this is such a core dependency, are there any of the weirder ports that should be tested? I tried to make the $STRIP -S command as universal as possible but I guess it could break some more exotic systems.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

nixos/tests/cpython-gdb.nix Outdated Show resolved Hide resolved
# debug info can't be separated from a static library and would otherwise be
# left in place by a separateDebugInfo build. force its removal here to save
# space in output.
$STRIP -S $out/lib/${libPrefix}/config-*/libpython*.a || true
Copy link
Member

Choose a reason for hiding this comment

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

How do we deal with debug info in case of static builds? Do we always just remove it?

Aside from this question this PR looks good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Various sources suggest that the thing to do is just put the whole debug static lib into the debug output. But doing this gets into the sticky situation of whether a debug output actually exists for platforms not supporting separateDebugInfo. And rather than doing something awkward that might break obscure platform x and get the whole PR reverted (again) I thought I'd keep this PR as straightforward as possible.

@jonringer
Copy link
Contributor

nixpkgs-review is failing to review staging PRs :(

@risicle
Copy link
Contributor Author

risicle commented May 17, 2021

Rebased on latest staging.

@ofborg ofborg bot requested a review from FRidh May 17, 2021 23:32
debug info can't be separated from a static library and would otherwise be
left in place by a separateDebugInfo build. force its removal here to save
space in output.
@risicle
Copy link
Contributor Author

risicle commented Aug 19, 2021

Rebased. Again.

Copy link
Member

@FRidh FRidh left a comment

Choose a reason for hiding this comment

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

I have not tested this but it looks good.

@risicle risicle merged commit ddbc530 into NixOS:staging Sep 13, 2021
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

3 participants