summaryrefslogtreecommitdiffstats
path: root/pkgs/development/compilers/halide
diff options
context:
space:
mode:
authorTom Westerhout <14264576+twesterhout@users.noreply.github.com>2023-08-22 10:57:32 +0200
committerTom Westerhout <14264576+twesterhout@users.noreply.github.com>2023-08-22 10:57:32 +0200
commitc841f93dd98880f5a62c4995a3c9082f4478d2d6 (patch)
treeec4a7b1e3a47936c74b9bd5f716bad6c125bf484 /pkgs/development/compilers/halide
parentb55f063caf98b12852f33d159d8fbb6b3dfc6646 (diff)
halide: ::aligned_alloc is not available on x86_64-darwin
Diffstat (limited to 'pkgs/development/compilers/halide')
-rw-r--r--pkgs/development/compilers/halide/default.nix9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkgs/development/compilers/halide/default.nix b/pkgs/development/compilers/halide/default.nix
index 9e04c5a2424b..232a006e4cf5 100644
--- a/pkgs/development/compilers/halide/default.nix
+++ b/pkgs/development/compilers/halide/default.nix
@@ -34,8 +34,11 @@ stdenv.mkDerivation rec {
#define HALIDE_CPP_COMPILER_HAS_FLOAT16' \
'#if defined(__x86_64__) || defined(__i386__)
#define HALIDE_CPP_COMPILER_HAS_FLOAT16'
-
- # AvailabilityVersions.h is part of Apple SDK, and we do not want to depend on it
+ ''
+ # Note: on x86_64-darwin, clang fails to find AvailabilityVersions.h, so we remove it.
+ # Halide uses AvailabilityVersions.h and TargetConditionals.h to determine whether
+ # ::aligned_alloc is available. For us, it isn't.
+ + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
substituteInPlace 'src/runtime/HalideBuffer.h' \
--replace '#ifdef __APPLE__
#include <AvailabilityVersions.h>
@@ -43,7 +46,7 @@ stdenv.mkDerivation rec {
#endif' \
' ' \
--replace 'TARGET_OS_OSX && (__MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_15)' \
- '0' \
+ '1' \
--replace 'TARGET_OS_IPHONE && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_14_0)' \
'0'
'';