-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
CoreFoundation.tbd hook breaks darwin -> non-darwin cross-compilation #278348
Comments
I had to work around this issue so I quickly hacked together this hook: makeSetupHook { name = "fixCoreFoundationCrossHook"; }
(writeScript "fixCoreFoundationCrossHook" ''
fixCoreFoundationCross() {
local old_ldflags=($NIX_LDFLAGS)
local new_ldflags=()
local old_cflags_compile=($NIX_CFLAGS_COMPILE)
local new_cflags_compile=()
for flag in "''${old_cflags_compile[@]}"; do
if [[ "$flag" != -F*/Library/Frameworks* ]]; then
new_cflags_compile+=("$flag")
fi
done
for flag in "''${old_ldflags[@]}"; do
if [[ "$flag" != *CoreFoundation.tbd* ]]; then
new_ldflags+=("$flag")
fi
done
NIX_LDFLAGS="''${new_ldflags[@]}"
NIX_CFLAGS_COMPILE="''${new_cflags_compile[@]}"
}
postConfigureHooks+=(fixCoreFoundationCross)
''); I load this only when cross-compiling from Darwin. |
I'd be happy to fix and test this with some guidance. I attempted the suggested fix using Edit: I assumed this might only be the case while bootstrapping, but it's not available in Edit 2: Figured it out. |
As of NixOS#265102, x86_64-darwin no longer uses the open-source CF release. Since there is no longer a need to switch between implementations, and the hook causes problems with cross-compilation (see NixOS#278348), drop the hook and make both darwin.CF an alias for darwin.apple_sdk.frameworks.CoreFoundation.
As of NixOS#265102, x86_64-darwin no longer uses the open-source CF release. Since there is no longer a need to switch between implementations, and the hook causes problems with cross-compilation (see NixOS#278348), drop the hook and make both darwin.CF an alias for darwin.apple_sdk.frameworks.CoreFoundation.
As of NixOS#265102, x86_64-darwin no longer uses the open-source CF release. Since there is no longer a need to switch between implementations, and the hook causes problems with cross-compilation (see NixOS#278348), drop the hook and make both darwin.CF an alias for darwin.apple_sdk.frameworks.CoreFoundation.
As of NixOS#265102, x86_64-darwin no longer uses the open-source CF release. Since there is no longer a need to switch between implementations, and the hook causes problems with cross-compilation (see NixOS#278348), drop the hook and make both darwin.CF an alias for darwin.apple_sdk.frameworks.CoreFoundation.
Closed by #346043 |
The CoreFoundation.tbd setup hook in darwin's CoreFoundation does not take build/host offsets into account, so it unconditionally applies CFLAGS/LDFLAGS which are invalid for non-darwin hosts. This can occur when a package pulls in CoreFoundation via a buildPackage's propagatedBuildInputs. Since CF is propagated by a number of packages, this occurs quite often.
This seems to have technically been an issue for as long as this setup hook has existed, but has only started causing problems now that we are explicitly linking the .tbd file. Previously it was an extraneous directory that could be ignored, but now the explicit .tbd file is seen as an invalid linker script by the target cross linker.
For example, see: nixpkgs:cross-trunk:rpi-musl.nix.x86_64-darwin (https://hydra.nixos.org/build/241448869/nixlog/1):
(This can be reproduced locally on x86_64-darwin via
nix-build -A pkgsCross.muslpi.aws-sdk-cpp
)I suspect this may be fixed by using
role_post
correctly as in other libraries' setup hooks, e.g.:nixpkgs/pkgs/development/libraries/libiconv/setup-hook.sh
Lines 6 to 7 in a6c7882
However, making this change to CF's setup hook would be a a stdenv rebuild on darwin, and I don't have time at the moment to rebuild the world to test this out.
The text was updated successfully, but these errors were encountered: