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

bash: don't install loadables dir for static build #270975

Open
wants to merge 1 commit into
base: staging
Choose a base branch
from

Conversation

veehaitch
Copy link
Member

@veehaitch veehaitch commented Nov 29, 2023

The dynamic build ships a bunch of sample loadable builtins and installs them to $out/lib/bash. When building statically with musl, the target fails as it cannot produce any of the dynamically linked loadable builtins.

Although the failure is not fatal, it also introduces an impurity due to the heavy parallelization: sometimes the files loadables.h and Makefile.sample end up in $out/lib/bash depending on how fast the compilation of the loadable builtins fails. Try the following to reproduce the issue:

nix build --rebuild --cores 48 nixpkgs#pkgsStatic.bash

This commit skips building and installing the loadable builtins altogether if building statically.

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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.

Priorities

Add a 👍 reaction to pull requests you find important.

Copy link
Contributor

@wentasah wentasah left a comment

Choose a reason for hiding this comment

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

This looks good to me. I can reproduce the reported non-reproducibility. It disappears with this change applied. All made changes make sense to me. The comments are clear.

@veehaitch veehaitch added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 3, 2023
infodir=$(infodir) htmldir=$(htmldir) DESTDIR=$(DESTDIR) $@ )
-( cd $(DEFDIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
-( cd $(PO_DIR) ; $(MAKE) $(MFLAGS) DESTDIR=$(DESTDIR) $@ )
+ifeq (,$(findstring -static,$(STATIC_LD)))
Copy link
Member

Choose a reason for hiding this comment

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

Can you try upstreaming this, too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I can give it a shot.

@delroth delroth added 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Dec 12, 2023
pkgs/shells/bash/5.nix Show resolved Hide resolved
The dynamic build ships a bunch of sample loadable builtins and installs
them to `$out/lib/bash`. When building statically with musl, the target
fails as it cannot produce any of the dynamically linked loadable
builtins.

Although the failure is not fatal, it also introduces an impurity due to
the heavy parallelization: _sometimes_ the files `loadables.h` and
`Makefile.sample` end up in `$out/lib/bash` depending on how fast the
compilation of the loadable builtins fails. Try the following to
reproduce the issue:

        nix build --rebuild --cores 48 nixpkgs#pkgsStatic.bash

This commit skips building and installing the loadable builtins
altogether if building statically.
@alyssais
Copy link
Member

Awesome, thanks! I'd like to wait a little bit to see what upstream says, in case we can avoid carrying the patch.

@delroth delroth removed the 12.approvals: 2 This PR was reviewed and approved by two reputable people label Dec 17, 2023
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 22, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: reproducible builds 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+ 10.rebuild-linux-stdenv This PR causes stdenv to rebuild
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants