Skip to content

haskell.compiler.ghc902Binary: fix (system) libffi header discovery #421477

Merged
wolfgangwalther merged 2 commits intoNixOS:stagingfrom
sternenseemann:ghc-9.0.2-darwin-ffi-headers
Jul 2, 2025
Merged

haskell.compiler.ghc902Binary: fix (system) libffi header discovery #421477
wolfgangwalther merged 2 commits intoNixOS:stagingfrom
sternenseemann:ghc-9.0.2-darwin-ffi-headers

Conversation

@sternenseemann
Copy link
Member

(GHC 9.4 test build is still running)

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/)
  • Nixpkgs 25.11 Release Notes (or backporting 24.11 and 25.05 Nixpkgs Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
  • NixOS 25.11 Release Notes (or backporting 24.11 and 25.05 NixOS Release notes)
    • (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, pkgs/README.md, maintainers/README.md and other contributing documentation in corresponding paths.

Add a 👍 reaction to pull requests you find important.

Interestingly, this did not break anything super obvious before, but now
paths between GHC and separate libraries match.
@nix-owners nix-owners bot requested review from maralorn and wolfgangwalther July 1, 2025 11:50
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 6.topic: haskell General-purpose, statically typed, purely functional programming language labels Jul 1, 2025
@nix-owners nix-owners bot requested a review from cdepillabout July 1, 2025 11:55
The GHC 9.0.2 bindist expects the headers of libffi to be found under
/Applications/XCode.app instead of /Library (which is the case for later
GHC bindists which I copied the code from). Correctly substituting this
path will prevent GHC from using the bundled and thus outdated libffi
headers that are broken for some reason or other.

That these bundled headers were installed was actually a bug in hadrian
which created the bindists because it ignored use-system-libffi before
GHC 9.2. (This was actually the issue I noticed first because it hides
the actual problem: Because GHC installed these headers, GHC found some
version of ffi.h and ffitarget.h instead of correctly failing due to
missing headers which would indicate that package db is broken.) For the
sake of completeness, we can also solve this problem by deleting these
headers in postInstall.
@sternenseemann sternenseemann force-pushed the ghc-9.0.2-darwin-ffi-headers branch from fb415fc to fbbdcdd Compare July 1, 2025 12:48
@sternenseemann
Copy link
Member Author

haskell.packages.ghc94.random succeeds on aarch64-darwin.

@sternenseemann sternenseemann changed the base branch from haskell-updates to staging July 1, 2025 22:48
@nixpkgs-ci nixpkgs-ci bot closed this Jul 1, 2025
@nixpkgs-ci nixpkgs-ci bot reopened this Jul 1, 2025
Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

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

Changes LGTM.

Did some more testing and all good, so far. x86_64-darwin build still pending, but I don't expect any surprises. Edit: Ah, I see you did that already by now. Will skip that.

There was one surprise, though: This is the first time, I think, that I was able to build pkgsStatic.haskell.packages.ghc94.hello successfully on darwin. Did pkgsStatic ever work on darwin before? I might be mistaken, but I think the last few times I tried it didn't work.

Now, whether that's because of this PR or not is a different question, but this is massive!

(I was not able to build th-orphans as a random TH package, yet, but that was gmp-related, so I am currently trying with native-bignum)

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Jul 2, 2025
@wolfgangwalther
Copy link
Contributor

Building pkgsStatic.haskell.packages.native-bignum.ghc94.postgrest on aarch64-darwin almost works!

Building library for postgrest-13.0.4..
[ 1 of 47] Compiling Paths_postgrest  ( dist/build/autogen/Paths_postgrest.hs, dist/build/Paths_postgrest.o )
[ 2 of 47] Compiling PostgREST.Auth.Types ( src/PostgREST/Auth/Types.hs, dist/build/PostgREST/Auth/Types.o )
[ 3 of 47] Compiling PostgREST.Config.JSPath ( src/PostgREST/Config/JSPath.hs, dist/build/PostgREST/Config/JSPath.o )
[ 4 of 47] Compiling PostgREST.Config.PgVersion ( src/PostgREST/Config/PgVersion.hs, dist/build/PostgREST/Config/PgVersion.o )
[ 5 of 47] Compiling PostgREST.Config.Database ( src/PostgREST/Config/Database.hs, dist/build/PostgREST/Config/Database.o )
/nix/store/8rxrkp0f1d8563nkmdz6dswffsbk1f8m-stdenv-darwin/setup: line 1771: 68228 Segmentation fault: 11  ./Setup build

I certainly have never made it actually into the static PostgREST build on darwin. Even though I haven't fully made it, yet, this is 🚀!

@wolfgangwalther
Copy link
Contributor

In any case, ghc902Binary has bootstrapped well ;)

@wolfgangwalther wolfgangwalther merged commit 98e54c7 into NixOS:staging Jul 2, 2025
51 of 52 checks passed
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Jul 2, 2025

Successfully created backport PR for release-25.05:

@github-actions github-actions bot added the 8.has: port to stable This PR already has a backport to the stable release. label Jul 2, 2025
@sternenseemann sternenseemann deleted the ghc-9.0.2-darwin-ffi-headers branch July 3, 2025 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants