ceph: Work around broken build with arrow-cpp >= 20. Fixes #406306

+340
+335
pkgs/tools/filesystems/ceph/arrow-cpp-19.nix
···
··· 1 + # This is is arrow-cpp < 20 used as a workaround for 2 + # Ceph not supporting >= yet, taken from nixpkgs commit 3 + # 97ae53798f6a7c7c3c259ad8c2cbcede6ca34b2a~ 4 + # This should be entirely removed when upstream bug 5 + # https://tracker.ceph.com/issues/71269 6 + # is fixed. 7 + { 8 + stdenv, 9 + lib, 10 + fetchurl, 11 + fetchFromGitHub, 12 + fixDarwinDylibNames, 13 + autoconf, 14 + aws-sdk-cpp, 15 + aws-sdk-cpp-arrow ? aws-sdk-cpp.override { 16 + apis = [ 17 + "cognito-identity" 18 + "config" 19 + "identity-management" 20 + "s3" 21 + "sts" 22 + "transfer" 23 + ]; 24 + }, 25 + boost, 26 + brotli, 27 + bzip2, 28 + cmake, 29 + crc32c, 30 + curl, 31 + flatbuffers, 32 + gflags, 33 + glog, 34 + google-cloud-cpp, 35 + grpc, 36 + gtest, 37 + libbacktrace, 38 + lz4, 39 + minio, 40 + ninja, 41 + nlohmann_json, 42 + openssl, 43 + perl, 44 + pkg-config, 45 + protobuf_29, 46 + python3, 47 + rapidjson, 48 + re2, 49 + snappy, 50 + sqlite, 51 + thrift, 52 + tzdata, 53 + utf8proc, 54 + which, 55 + zlib, 56 + zstd, 57 + testers, 58 + enableShared ? !stdenv.hostPlatform.isStatic, 59 + enableFlight ? stdenv.buildPlatform == stdenv.hostPlatform, 60 + # Disable also on RiscV 61 + # configure: error: cannot determine number of significant virtual address bits 62 + enableJemalloc ? 63 + !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isRiscV64, 64 + enableS3 ? true, 65 + # google-cloud-cpp fails to build on RiscV 66 + enableGcs ? !stdenv.hostPlatform.isDarwin && !stdenv.hostPlatform.isRiscV64, 67 + }: 68 + 69 + let 70 + # https://github.com/apache/arrow/issues/45807 71 + protobuf = protobuf_29; 72 + 73 + arrow-testing = fetchFromGitHub { 74 + name = "arrow-testing"; 75 + owner = "apache"; 76 + repo = "arrow-testing"; 77 + rev = "4d209492d514c2d3cb2d392681b9aa00e6d8da1c"; 78 + hash = "sha256-IkiCbuy0bWyClPZ4ZEdkEP7jFYLhM7RCuNLd6Lazd4o="; 79 + }; 80 + 81 + parquet-testing = fetchFromGitHub { 82 + name = "parquet-testing"; 83 + owner = "apache"; 84 + repo = "parquet-testing"; 85 + rev = "c7cf1374cf284c0c73024cd1437becea75558bf8"; 86 + hash = "sha256-DThjyZ34LajHwXZy1IhYKUGUG/ejQ9WvBNuI8eUKmSs="; 87 + }; 88 + 89 + version = "19.0.1"; 90 + in 91 + stdenv.mkDerivation (finalAttrs: { 92 + pname = "arrow-cpp"; 93 + inherit version; 94 + 95 + src = fetchFromGitHub { 96 + owner = "apache"; 97 + repo = "arrow"; 98 + rev = "apache-arrow-${version}"; 99 + hash = "sha256-toHwUIOZRpgR0K7pQtT5nqWpO9G7AuHYTcvA6UVg9lA="; 100 + }; 101 + 102 + sourceRoot = "${finalAttrs.src.name}/cpp"; 103 + 104 + # versions are all taken from 105 + # https://github.com/apache/arrow/blob/apache-arrow-${version}/cpp/thirdparty/versions.txt 106 + 107 + # jemalloc: arrow uses a custom prefix to prevent default allocator symbol 108 + # collisions as well as custom build flags 109 + ${if enableJemalloc then "ARROW_JEMALLOC_URL" else null} = fetchurl { 110 + url = "https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2"; 111 + hash = "sha256-LbgtHnEZ3z5xt2QCGbbf6EeJvAU3mDw7esT3GJrs/qo="; 112 + }; 113 + 114 + # mimalloc: arrow uses custom build flags for mimalloc 115 + ARROW_MIMALLOC_URL = fetchFromGitHub { 116 + owner = "microsoft"; 117 + repo = "mimalloc"; 118 + rev = "v2.0.6"; 119 + hash = "sha256-u2ITXABBN/dwU+mCIbL3tN1f4c17aBuSdNTV+Adtohc="; 120 + }; 121 + 122 + ARROW_XSIMD_URL = fetchFromGitHub { 123 + owner = "xtensor-stack"; 124 + repo = "xsimd"; 125 + rev = "13.0.0"; 126 + hash = "sha256-qElJYW5QDj3s59L3NgZj5zkhnUMzIP2mBa1sPks3/CE="; 127 + }; 128 + 129 + ARROW_SUBSTRAIT_URL = fetchFromGitHub { 130 + owner = "substrait-io"; 131 + repo = "substrait"; 132 + rev = "v0.44.0"; 133 + hash = "sha256-V739IFTGPtbGPlxcOi8sAaYSDhNUEpITvN9IqdPReug="; 134 + }; 135 + 136 + nativeBuildInputs = [ 137 + cmake 138 + pkg-config 139 + ninja 140 + autoconf # for vendored jemalloc 141 + flatbuffers 142 + ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; 143 + buildInputs = 144 + [ 145 + boost 146 + brotli 147 + bzip2 148 + flatbuffers 149 + gflags 150 + glog 151 + gtest 152 + libbacktrace 153 + lz4 154 + nlohmann_json # alternative JSON parser to rapidjson 155 + protobuf # substrait requires protobuf 156 + rapidjson 157 + re2 158 + snappy 159 + thrift 160 + utf8proc 161 + zlib 162 + zstd 163 + ] 164 + ++ lib.optionals enableFlight [ 165 + grpc 166 + openssl 167 + protobuf 168 + sqlite 169 + ] 170 + ++ lib.optionals enableS3 [ 171 + aws-sdk-cpp-arrow 172 + openssl 173 + ] 174 + ++ lib.optionals enableGcs [ 175 + crc32c 176 + curl 177 + google-cloud-cpp 178 + grpc 179 + nlohmann_json 180 + ]; 181 + 182 + preConfigure = '' 183 + patchShebangs build-support/ 184 + substituteInPlace "src/arrow/vendored/datetime/tz.cpp" \ 185 + --replace-fail 'discover_tz_dir();' '"${tzdata}/share/zoneinfo";' 186 + ''; 187 + 188 + cmakeFlags = 189 + [ 190 + "-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON" 191 + "-DARROW_BUILD_SHARED=${if enableShared then "ON" else "OFF"}" 192 + "-DARROW_BUILD_STATIC=${if enableShared then "OFF" else "ON"}" 193 + "-DARROW_BUILD_TESTS=${if enableShared then "ON" else "OFF"}" 194 + "-DARROW_BUILD_INTEGRATION=ON" 195 + "-DARROW_BUILD_UTILITIES=ON" 196 + "-DARROW_EXTRA_ERROR_CONTEXT=ON" 197 + "-DARROW_VERBOSE_THIRDPARTY_BUILD=ON" 198 + "-DARROW_DEPENDENCY_SOURCE=SYSTEM" 199 + "-Dxsimd_SOURCE=AUTO" 200 + "-DARROW_DEPENDENCY_USE_SHARED=${if enableShared then "ON" else "OFF"}" 201 + "-DARROW_COMPUTE=ON" 202 + "-DARROW_CSV=ON" 203 + "-DARROW_DATASET=ON" 204 + "-DARROW_FILESYSTEM=ON" 205 + "-DARROW_FLIGHT_SQL=${if enableFlight then "ON" else "OFF"}" 206 + "-DARROW_HDFS=ON" 207 + "-DARROW_IPC=ON" 208 + "-DARROW_JEMALLOC=${if enableJemalloc then "ON" else "OFF"}" 209 + "-DARROW_JSON=ON" 210 + "-DARROW_USE_GLOG=ON" 211 + "-DARROW_WITH_BACKTRACE=ON" 212 + "-DARROW_WITH_BROTLI=ON" 213 + "-DARROW_WITH_BZ2=ON" 214 + "-DARROW_WITH_LZ4=ON" 215 + "-DARROW_WITH_NLOHMANN_JSON=ON" 216 + "-DARROW_WITH_SNAPPY=ON" 217 + "-DARROW_WITH_UTF8PROC=ON" 218 + "-DARROW_WITH_ZLIB=ON" 219 + "-DARROW_WITH_ZSTD=ON" 220 + "-DARROW_MIMALLOC=ON" 221 + "-DARROW_SUBSTRAIT=ON" 222 + "-DARROW_FLIGHT=${if enableFlight then "ON" else "OFF"}" 223 + "-DARROW_FLIGHT_TESTING=${if enableFlight then "ON" else "OFF"}" 224 + "-DARROW_S3=${if enableS3 then "ON" else "OFF"}" 225 + "-DARROW_GCS=${if enableGcs then "ON" else "OFF"}" 226 + # Parquet options: 227 + "-DARROW_PARQUET=ON" 228 + "-DPARQUET_BUILD_EXECUTABLES=ON" 229 + "-DPARQUET_REQUIRE_ENCRYPTION=ON" 230 + ] 231 + ++ lib.optionals (!enableShared) [ "-DARROW_TEST_LINKAGE=static" ] 232 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 233 + "-DCMAKE_INSTALL_RPATH=@loader_path/../lib" # needed for tools executables 234 + ] 235 + ++ lib.optionals (!stdenv.hostPlatform.isx86_64) [ "-DARROW_USE_SIMD=OFF" ] 236 + ++ lib.optionals enableS3 [ 237 + "-DAWSSDK_CORE_HEADER_FILE=${aws-sdk-cpp-arrow}/include/aws/core/Aws.h" 238 + ]; 239 + 240 + doInstallCheck = true; 241 + ARROW_TEST_DATA = lib.optionalString finalAttrs.doInstallCheck "${arrow-testing}/data"; 242 + PARQUET_TEST_DATA = lib.optionalString finalAttrs.doInstallCheck "${parquet-testing}/data"; 243 + GTEST_FILTER = 244 + let 245 + # Upstream Issue: https://issues.apache.org/jira/browse/ARROW-11398 246 + filteredTests = 247 + lib.optionals stdenv.hostPlatform.isAarch64 [ 248 + "TestFilterKernelWithNumeric/3.CompareArrayAndFilterRandomNumeric" 249 + "TestFilterKernelWithNumeric/7.CompareArrayAndFilterRandomNumeric" 250 + "TestCompareKernel.PrimitiveRandomTests" 251 + ] 252 + ++ lib.optionals enableS3 [ 253 + "S3OptionsTest.FromUri" 254 + "S3RegionResolutionTest.NonExistentBucket" 255 + "S3RegionResolutionTest.PublicBucket" 256 + "S3RegionResolutionTest.RestrictedBucket" 257 + "TestMinioServer.Connect" 258 + "TestS3FS.*" 259 + "TestS3FSGeneric.*" 260 + ] 261 + ++ lib.optionals stdenv.hostPlatform.isDarwin [ 262 + # TODO: revisit at 12.0.0 or when 263 + # https://github.com/apache/arrow/commit/295c6644ca6b67c95a662410b2c7faea0920c989 264 + # is available, see 265 + # https://github.com/apache/arrow/pull/15288#discussion_r1071244661 266 + "ExecPlanExecution.StressSourceSinkStopped" 267 + ]; 268 + in 269 + lib.optionalString finalAttrs.doInstallCheck "-${lib.concatStringsSep ":" filteredTests}"; 270 + 271 + __darwinAllowLocalNetworking = true; 272 + 273 + nativeInstallCheckInputs = 274 + [ 275 + perl 276 + which 277 + sqlite 278 + ] 279 + ++ lib.optionals enableS3 [ minio ] 280 + ++ lib.optionals enableFlight [ python3 ]; 281 + 282 + installCheckPhase = 283 + let 284 + disabledTests = [ 285 + # flaky 286 + "arrow-flight-test" 287 + # requires networking 288 + "arrow-gcsfs-test" 289 + "arrow-flight-integration-test" 290 + ]; 291 + in 292 + '' 293 + runHook preInstallCheck 294 + 295 + ctest -L unittest --exclude-regex '^(${lib.concatStringsSep "|" disabledTests})$' 296 + 297 + runHook postInstallCheck 298 + ''; 299 + 300 + meta = with lib; { 301 + description = "Cross-language development platform for in-memory data"; 302 + homepage = "https://arrow.apache.org/docs/cpp/"; 303 + license = licenses.asl20; 304 + platforms = platforms.unix; 305 + maintainers = with maintainers; [ 306 + tobim 307 + veprbl 308 + cpcloud 309 + ]; 310 + pkgConfigModules = [ 311 + "arrow" 312 + "arrow-acero" 313 + "arrow-compute" 314 + "arrow-csv" 315 + "arrow-dataset" 316 + "arrow-filesystem" 317 + "arrow-flight" 318 + "arrow-flight-sql" 319 + "arrow-flight-testing" 320 + "arrow-json" 321 + "arrow-substrait" 322 + "arrow-testing" 323 + "parquet" 324 + ]; 325 + }; 326 + passthru = { 327 + inherit 328 + enableFlight 329 + enableJemalloc 330 + enableS3 331 + enableGcs 332 + ; 333 + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 334 + }; 335 + })
+5
pkgs/top-level/all-packages.nix
··· 2548 # If we want to switch for that before upstream fixes it, use this patch: 2549 # https://github.com/NixOS/nixpkgs/pull/281858#issuecomment-1899648638 2550 fmt = fmt_9; 2551 }) 2552 ceph 2553 ceph-client
··· 2548 # If we want to switch for that before upstream fixes it, use this patch: 2549 # https://github.com/NixOS/nixpkgs/pull/281858#issuecomment-1899648638 2550 fmt = fmt_9; 2551 + 2552 + # Remove once Ceph supports arrow-cpp >= 20, see: 2553 + # * https://tracker.ceph.com/issues/71269 2554 + # * https://github.com/NixOS/nixpkgs/issues/406306 2555 + arrow-cpp = callPackage ../tools/filesystems/ceph/arrow-cpp-19.nix { }; 2556 }) 2557 ceph 2558 ceph-client