From 092b50a92c5b63dde16b057a9da89c53729ee3c3 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 3 Oct 2024 07:47:30 -0400 Subject: [PATCH] python3: fix stdenv bootstrap on x86_64-darwin The bootstrap tools linker sometimes crashes when trying to link the sqlite3 tests, which causes the bootstrap Python not to have the sqlite3 module. This causes the freezegun module to fail to build later in the bootstrap. Using the 11.0 SDK fixes the problem. Upstream Python supports building with a newer SDK and back-deploying, so this change should not negatively affect users on pre-11.0 releases. --- pkgs/development/interpreters/python/cpython/default.nix | 4 ++++ pkgs/stdenv/darwin/default.nix | 2 ++ 2 files changed, 6 insertions(+) diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index 89ffae4b3d18..b381243ff5bb 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -25,6 +25,7 @@ # platform-specific dependencies , bash +, apple-sdk_11 , darwin , windows @@ -177,6 +178,9 @@ let bluez ] ++ optionals enableFramework [ darwin.apple_sdk.frameworks.Cocoa + ] ++ optionals stdenv.hostPlatform.isDarwin [ + # Work around for ld64 crashes on x86_64-darwin. Remove once 11.0 becomes the default. + apple-sdk_11 ] ++ optionals stdenv.hostPlatform.isMinGW [ windows.dlfcn windows.mingw_w64_pthreads diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index 1ae60ab4d821..cee3f98e9031 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -648,6 +648,8 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check self = self.python3-bootstrap; pythonAttr = "python3-bootstrap"; enableLTO = false; + # Workaround for ld64 crashes on x86_64-darwin. Remove after 11.0 is made the default. + inherit (prevStage) apple-sdk_11; }; scons = super.scons.override { python3Packages = self.python3.pkgs; };