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

darwin.apple_sdk: remove print-reexports #182094

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

thefloweringash
Copy link
Member

@thefloweringash thefloweringash commented Jul 19, 2022

Related to #181550. Not yet complete! Uses stubs from the no-prelink branch (NixOS/darwin-stubs#8).


Description of changes

Darwin support in nixpkgs uses textual api stubs (tbd files). These files refer to each other in "re-export" sections with absolute paths like /System/Library/Foo.framework. We want the entire closure to refer to the corresponding version in the nix store.

In the 10.12 SDK, this uses a spread out process of pre-mangling to stubs to have @Foo@ tokens which can then be easily replaced without parsing, and print-reexports to check that all referenced files exist. This requires only minimal shell in the bootstrap tools.

In the 11.0 SDK, this uses a new tool called rewrite-tbd (https://github.com/thefloweringash/rewrite-tbd), which has prefix mapping, constant mapping, and checks that all paths exist and are in the nix store. This requires no preprocessing, but requires rewrite-tbd in the bootstrap tools.

The rewrite-tbd method also uses passthru.tbdRewrites attributes from dependencies, which makes fewer assumptions about which dependencies own which files.

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/)
  • 22.11 Release Notes (or backporting 22.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
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Jul 19, 2022
@thefloweringash thefloweringash changed the title Remove print reexports darwin.apple_sdk: remove print-reexports Jul 19, 2022
Copy link
Contributor

@toonn toonn left a comment

Choose a reason for hiding this comment

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

Other than the local stubs this LGTM.

while IFS= read -r -d $'\0' tbd; do
echo "checkTbdRexports: checking re-exports in $tbd"
rewrite-tbd -r "$NIX_STORE" "$tbd"
done < <(find $prefix -type f -name '*.tbd' -print0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason the hook uses a different style from the apple_sdk installPhase? Very minor issue, feel free to ignore.

Copy link
Member Author

Choose a reason for hiding this comment

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

No good reason. I think this version with null delimiters is technically more correct. I've used this style in both.

Comment on lines -303 to -308
ln -s libSystem.B.tbd $out/lib/libSystem.tbd

for name in c dbm dl info m mx poll proc pthread rpcsvc util gcc_s.10.4 gcc_s.10.5; do
ln -s libSystem.tbd $out/lib/lib$name.tbd
done

Copy link
Contributor

Choose a reason for hiding this comment

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

Was this only necessary for print-reexports?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a consequence of updating the darwin stubs to include NixOS/darwin-stubs#5. I'm not yet sure this is correct.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, right, I dropped them in this commit too, FWIW.

@thefloweringash thefloweringash force-pushed the remove-print-reexports branch from c43f246 to 8e24473 Compare July 20, 2022 06:05
@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label Jul 20, 2022
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 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: darwin Running or building packages on Darwin 6.topic: stdenv Standard environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants