Merge pull request #310666 from annaleeleaves/torch-fix-x64-darwin

python312Packages.torch: fix aligned_alloc error on darwin
This commit is contained in:
Weijia Wang 2024-05-11 10:55:00 +02:00 committed by GitHub
commit 5a6b8042a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -205,8 +205,8 @@ in buildPythonPackage rec {
# error: no member named 'aligned_alloc' in the global namespace; did you mean simply 'aligned_alloc'
# This lib overrided aligned_alloc hence the error message. Tltr: his function is linkable but not in header.
+ lib.optionalString (stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11.0") ''
substituteInPlace third_party/pocketfft/pocketfft_hdronly.h --replace '#if __cplusplus >= 201703L
inline void *aligned_alloc(size_t align, size_t size)' '#if __cplusplus >= 201703L && 0
substituteInPlace third_party/pocketfft/pocketfft_hdronly.h --replace-fail '#if (__cplusplus >= 201703L) && (!defined(__MINGW32__)) && (!defined(_MSC_VER))
inline void *aligned_alloc(size_t align, size_t size)' '#if 0
inline void *aligned_alloc(size_t align, size_t size)'
'';