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

ghc: bootstrap 9.8 from bindist again on Darwin #330560

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

reckenrode
Copy link
Contributor

@reckenrode reckenrode commented Jul 28, 2024

Description of changes

Split off from #330559. Targeting staging-next because the required version of ld64 is currently only on staging-next.

The issue was ar -L again. When I tried building GHC 9.8 without the fix, the build failed at Shake, but the error was different on staging-next with ld64 951.9.

ld: warning: ignoring file /nix/store/gr6f3icxkn8mpk3rdn0gi1qgk1ynk9kk-clock-0.8.4/lib/ghc-9.6.3/lib/aarch64-osx-ghc-9.6.3/clock-0.8.4-Bnns7LmnhG01nLONJf4lGG/libHSclock-0.8.4-Bnns7LmnhG01nLONJf4lGG.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
ld: in /nix/store/43r6s5nzb96445yy89366qh3y3jiy8ci-hashable-1.4.4.0/lib/ghc-9.6.3/lib/aarch64-osx-ghc-9.6.3/hashable-1.4.4.0-Ayk07ZB4soWJifMLtnGP0H/libHShashable-1.4.4.0-Ayk07ZB4soWJifMLtnGP0H.a(LowLevel.o), archive member 'LowLevel.o' with length 9024 is not mach-o or llvm bitcode file '/nix/store/43r6s5nzb96445yy89366qh3y3jiy8ci-hashable-1.4.4.0/lib/ghc-9.6.3/lib/aarch64-osx-ghc-9.6.3/hashable-1.4.4.0-Ayk07ZB4soWJifMLtnGP0H/libHShashable-1.4.4.0-Ayk07ZB4soWJifMLtnGP0H.a' for architecture arm64

After extracting the object from the file and inspecting it, I found that LowLevel.o was another archive. Static archives inside static archives are not supported by ld64. Fortunately, it’s possible to override GHC’s settings to suppress using ar -L, which allowed me to switch the bootstrap back to the bindist.

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/)
  • 24.11 Release Notes (or backporting 23.11 and 24.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.

Add a 👍 reaction to pull requests you find important.

The bindist defaults to enabling `ar -L` if it detects a compatible `ar`. Suppress this behavior by overriding the setting. This allows the bindist to be used to bootstrap GHC 9.8.
@reckenrode
Copy link
Contributor Author

I fixed the commit reference in the reverted commit. Thanks @vcunat for retargeting this to master after staging-next was merged. @sternenseemann Pinging you since you worked on the previous solution, and this is Haskell-related.

Copy link
Member

@maralorn maralorn left a comment

Choose a reason for hiding this comment

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

I don’t feel particularly firm with the details, but I like this.

@maralorn maralorn merged commit 255f595 into NixOS:master Jul 30, 2024
26 of 27 checks passed
@maralorn
Copy link
Member

Thank you

@reckenrode reckenrode deleted the ghc-9.6.3-fixes branch July 30, 2024 12:14
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.

2 participants