haskell-modules/generic-builder.nix: work around useSystemCoreFoundationFramework hook#329526
Merged
vcunat merged 1 commit intoNixOS:staging-nextfrom Jul 24, 2024
Merged
Conversation
In 23.11, Darwin was changes to use the system CoreFoundation both aarch64-darwin and x86_64-darwin. The ability to change between implementations was removed, but the hook was left in place because at the time it was harmless. Unfortunately, that is no longer the case.
After the upgrade of ld64 to 951.9, it is no longer as permissive about when `-rpath` may be used. It no longer allows the flag to be used when targeting macOS 10.5, and it no longer allows it when merging objects. The former was an issue for certain versions of GCC (now fixed). The latter is an issue for Haskell.
When a Haskell project uses Darwin frameworks and Cabal to build, they will fail to build without this workaround, giving the following error.
ld: -rpath can only be used when creating a dynamic final linked image
This is due to an optimization Cabal [performs][1]. If the linker supports creating relocatable objects or merging them, it will do so eagerly. This causes packages such as OpenGLRaw to fail to build due using Cabal and frameworks (OpenGL), which pull in the hook.
This workaround is ugly, but it will be reverted as soon as it hits staging and replaced with the real solution, which is removing the hook. The hook is only used with the 10.12 SDK. The 11.0 and 12.3 SDKs do not support the hook, and being able to switch CoreFoundation implementations is not anticipated to be restored in the future (due to problems it causes).
[1]: https://github.com/haskell/cabal/blob/705b6ebcaed649ed1a30b138b4348d24722d610a/Cabal/src/Distribution/Simple/Program/Builtin.hs#L341-L380
13 tasks
Member
|
This is another example, with dozens of builds depending on it: https://hydra.nixos.org/build/267146859 |
reckenrode
added a commit
to reckenrode/nixpkgs
that referenced
this pull request
Jul 25, 2024
Similar issue as NixOS#329526. Ruby 3.3 attempts to merge objects during the build, which fails due to stricter handling of `-rpath` in ld64.
13 tasks
reckenrode
added a commit
to reckenrode/nixpkgs
that referenced
this pull request
Jul 26, 2024
Darwin no longer supports switching between CoreFoundation implementations as of NixOS#265102. The setup hook is vestigial and was mostly harmless until NixOS#329526 was necessitated to fix build failures on staging-next NixOS#328673. The correct fix is to remove the hook. It’s not used by the 11.0 or 12.3 SDKs. This makes the 10.12 SDK a bit more like the other SDKs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes some Haskell build failures on x86_64-darwin on staging-next #328673.
In 23.11, Darwin was changes to use the system CoreFoundation both aarch64-darwin and x86_64-darwin. The ability to change between implementations was removed, but the hook was left in place because at the time it was harmless. Unfortunately, that is no longer the case.
After the upgrade of ld64 to 951.9, it is no longer as permissive about when
-rpathmay be used. It no longer allows the flag to be used when targeting macOS 10.5, and it no longer allows it when merging objects. The former was an issue for certain versions of GCC (now fixed). The latter is an issue for Haskell.When a Haskell project uses Darwin frameworks and Cabal to build, they will fail to build without this workaround, giving the following error.
This is due to an optimization Cabal performs. If the linker supports creating relocatable objects or merging them, it will do so eagerly. This causes packages such as OpenGLRaw to fail to build due using Cabal and frameworks (OpenGL), which pull in the hook.
This workaround is ugly, but it will be reverted as soon as it hits staging and replaced with the real solution, which is removing the hook. The hook is only used with the 10.12 SDK. The 11.0 and 12.3 SDKs do not support the hook, and being able to switch CoreFoundation implementations is not anticipated to be restored in the future (due to problems it causes).
Description of changes
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.