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

arrow-cpp: fix crash in tests on x86_64-darwin #265395

Merged
merged 4 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkgs/development/libraries/abseil-cpp/202103.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ stdenv.mkDerivation rec {
url = "https://github.com/abseil/abseil-cpp/commit/808bc202fc13e85a7948db0d7fb58f0f051200b1.patch";
sha256 = "sha256-ayY/aV/xWOdEyFSDqV7B5WDGvZ0ASr/aeBeYwP5RZVc=";
})
] ++ lib.optionals stdenv.isDarwin [
# Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
# that require a different SDK other than the default one.
./cmake-core-foundation.patch
];

cmakeFlags = [
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/libraries/abseil-cpp/202111.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ stdenv.mkDerivation rec {
sha256 = "sha256-sSXT6D4JSrk3dA7kVaxfKkzOMBpqXQb0WbMYWG+nGwk=";
};

patches = lib.optionals stdenv.isDarwin [
# Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
# that require a different SDK other than the default one.
./cmake-core-foundation.patch
];

cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
] ++ lib.optionals (cxxStandard != null) [
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/libraries/abseil-cpp/202206.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ stdenv.mkDerivation rec {
hash = "sha256-Od1FZOOWEXVQsnZBwGjDIExi6LdYtomyL0STR44SsG8=";
};

patches = lib.optionals stdenv.isDarwin [
# Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
# that require a different SDK other than the default one.
./cmake-core-foundation.patch
];

cmakeFlags = [
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
] ++ lib.optionals (cxxStandard != null) [
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/libraries/abseil-cpp/202301.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-PLoI7ix+reUqkZ947kWzls8lujYqWXk9A9a55UcfahI=";
};

patches = lib.optionals stdenv.isDarwin [
# Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
# that require a different SDK other than the default one.
./cmake-core-foundation.patch
];

cmakeFlags = [
"-DABSL_BUILD_TEST_HELPERS=ON"
"-DABSL_USE_EXTERNAL_GOOGLETEST=ON"
Expand Down
6 changes: 6 additions & 0 deletions pkgs/development/libraries/abseil-cpp/202308.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-uNGrTNg5G5xFGtc+BSWE389x0tQ/KxJQLHfebNWas/k=";
};

patches = lib.optionals stdenv.isDarwin [
# Don’t propagate the path to CoreFoundation. Otherwise, it’s impossible to build packages
# that require a different SDK other than the default one.
./cmake-core-foundation.patch
];

cmakeFlags = [
"-DABSL_BUILD_TEST_HELPERS=ON"
"-DABSL_USE_EXTERNAL_GOOGLETEST=ON"
Expand Down
12 changes: 12 additions & 0 deletions pkgs/development/libraries/abseil-cpp/cmake-core-foundation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff -ur a/absl/time/CMakeLists.txt b/absl/time/CMakeLists.txt
--- a/absl/time/CMakeLists.txt 1969-12-31 19:00:01.000000000 -0500
+++ b/absl/time/CMakeLists.txt 2023-10-30 21:50:32.639061785 -0400
@@ -55,7 +55,7 @@
)

if(APPLE)
- find_library(CoreFoundation CoreFoundation)
+ set(CoreFoundation "-framework CoreFoundation")
endif()

absl_cc_library(
7 changes: 5 additions & 2 deletions pkgs/stdenv/adapters.nix
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ rec {
) darwinMinVersion darwinSdkVersion;

sdk = pkgs.darwin."apple_sdk_${lib.replaceStrings [ "." ] [ "_" ] darwinSdkVersion}";
# TODO: Make this unconditional after #229210 has been merged,
# and the 10.12 SDK is updated to follow the new structure.
Libsystem = if darwinSdkVersion == "10.12" then pkgs.darwin.Libsystem else sdk.Libsystem;

replacePropagatedFrameworks = pkg:
let
Expand Down Expand Up @@ -349,8 +352,8 @@ rec {
// lib.genAttrs atBuildInputs (input: map mapRuntimeToSDK (args."${input}" or [ ]));

mkCC = cc: cc.override {
bintools = cc.bintools.override { libc = sdk.Libsystem; };
libc = sdk.Libsystem;
bintools = cc.bintools.override { libc = Libsystem; };
libc = Libsystem;
};
in
# TODO: make this work across all input types and not just propagatedBuildInputs
Expand Down
38 changes: 27 additions & 11 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20515,10 +20515,30 @@ with pkgs;

aalib = callPackage ../development/libraries/aalib { };

abseil-cpp_202103 = callPackage ../development/libraries/abseil-cpp/202103.nix { };
abseil-cpp_202206 = callPackage ../development/libraries/abseil-cpp/202206.nix { };
abseil-cpp_202301 = callPackage ../development/libraries/abseil-cpp/202301.nix { };
abseil-cpp_202308 = callPackage ../development/libraries/abseil-cpp/202308.nix { };
abseil-cpp_202103 = callPackage ../development/libraries/abseil-cpp/202103.nix {
# If abseil-cpp doesn’t have a deployment target of 10.13+, arrow-cpp crashes in libgrpc.dylib.
stdenv = if stdenv.isDarwin && stdenv.isx86_64
then overrideSDK stdenv { darwinMinVersion = "10.13"; }
else stdenv;
};
abseil-cpp_202206 = callPackage ../development/libraries/abseil-cpp/202206.nix {
# If abseil-cpp doesn’t have a deployment target of 10.13+, arrow-cpp crashes in libgrpc.dylib.
stdenv = if stdenv.isDarwin && stdenv.isx86_64
then overrideSDK stdenv { darwinMinVersion = "10.13"; }
else stdenv;
};
abseil-cpp_202301 = callPackage ../development/libraries/abseil-cpp/202301.nix {
# If abseil-cpp doesn’t have a deployment target of 10.13+, arrow-cpp crashes in libgrpc.dylib.
stdenv = if stdenv.isDarwin && stdenv.isx86_64
then overrideSDK stdenv { darwinMinVersion = "10.13"; }
else stdenv;
};
abseil-cpp_202308 = callPackage ../development/libraries/abseil-cpp/202308.nix {
# If abseil-cpp doesn’t have a deployment target of 10.13+, arrow-cpp crashes in libgrpc.dylib.
stdenv = if stdenv.isDarwin && stdenv.isx86_64
then overrideSDK stdenv { darwinMinVersion = "10.13"; }
else stdenv;
};
abseil-cpp = abseil-cpp_202301;

accountsservice = callPackage ../development/libraries/accountsservice { };
Expand Down Expand Up @@ -21807,13 +21827,9 @@ with pkgs;
grilo-plugins = callPackage ../development/libraries/grilo-plugins { };

grpc = callPackage ../development/libraries/grpc {
stdenv = if (stdenv.isDarwin && stdenv.isx86_64) then
# Work around Clang check for 10.13 when using aligned allocations with C++17.
stdenv.override (old: {
hostPlatform = old.hostPlatform // { darwinMinVersion = "10.13"; };
buildPlatform = old.buildPlatform // { darwinMinVersion = "10.13"; };
targetPlatform = old.targetPlatform // { darwinMinVersion = "10.13"; };
})
# Work around Clang check for 10.13 when using aligned allocations with C++17.
stdenv = if stdenv.isDarwin && stdenv.isx86_64
then overrideSDK stdenv { darwinMinVersion = "10.13"; }
else stdenv;
};

Expand Down