Skip to content

swift: update for cc-wrapper changes#250296

Merged
vcunat merged 1 commit intoNixOS:staging-nextfrom
reckenrode:swift-fix
Aug 20, 2023
Merged

swift: update for cc-wrapper changes#250296
vcunat merged 1 commit intoNixOS:staging-nextfrom
reckenrode:swift-fix

Conversation

@reckenrode
Copy link
Contributor

@reckenrode reckenrode commented Aug 20, 2023

The Swift compiler derivation modifies the clang wrapper to use exec -a "$0" to allow it to use the same binary for both clang and clang++. The sed script it uses to do this fails after the cc-wrapper changes in 6f2b3ba were merged.

This is fixed by updating makeClangWrapper to work with the cc-wrapper changes by having Bash invoke a simple script that uses exec -a "$0" to set the required name for clang.

This fixes the staging-next build failures with Swift on Darwin and Linux.

#248496 (comment)

Description of changes

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.

The Swift compiler derivation modifies the clang wrapper to use
`exec -a "$0"` to allow it to use the same binary for both `clang` and
`clang++`. The sed script it uses to do this fails after the cc-wrapper
changes in 6f2b3ba were merged.

This is fixed by updating `makeClangWrapper` to work with the cc-wrapper
changes by having Bash invoke a simple script that uses `exec -a "$0"`
to set the required name for clang.

This fixes the staging-next build failures with Swift on Darwin and Linux.

NixOS#248496 (comment)
@ofborg ofborg bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. labels Aug 20, 2023
@vcunat
Copy link
Member

vcunat commented Aug 20, 2023

@ofborg build swift

@vcunat vcunat mentioned this pull request Aug 20, 2023
2 tasks
@vcunat
Copy link
Member

vcunat commented Aug 20, 2023

I locally checked building swift on x86_64-darwin.

@vcunat
Copy link
Member

vcunat commented Aug 20, 2023

Oh yeah, and I almost forgot that I tried this out on Hydra already :-D
https://hydra.nixos.org/eval/1798668#tabs-now-succeed

Copy link
Contributor

@stephank stephank left a comment

Choose a reason for hiding this comment

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

Darn, I hadn't considered that could cause the failure. Thanks for figuring this out, must've been annoying!

It's unfortunate that it's not obvious when this fails, and how easy it is to break. It doesn't look like sed let's you verify the amount of matches/replacements? Maybe we can cheese it with a simple check over diff output using diff ... | wc -l? (Probably a separate PR.)

@vcunat vcunat merged commit fc70e5a into NixOS:staging-next Aug 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants