From cb1de51390a73668586d53cd515f3efbe5613804 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 22 Apr 2025 00:50:22 +0100 Subject: [PATCH 1/4] =?UTF-8?q?apple-sdk:=20fix=20stub=20processing=20clea?= =?UTF-8?q?n=E2=80=90up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `-delete-input` doesn’t work here, for whatever reason. --- pkgs/by-name/ap/apple-sdk/common/process-stubs.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix b/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix index d562816c17bd..1720d9f27cd7 100644 --- a/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix +++ b/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix @@ -35,7 +35,8 @@ self: super: { | .main_library.reexported_libraries[].names[] |= select([.] | inside($libs) | not) ' > usr/lib/$libSystem~ # Convert libSystem back to tbd-v4 because not all tooling supports the JSON-based format yet. - llvm-readtapi -delete-input --filetype=tbd-v4 usr/lib/$libSystem~ -o usr/lib/$libSystem + llvm-readtapi --filetype=tbd-v4 usr/lib/$libSystem~ -o usr/lib/$libSystem + rm usr/lib/$libSystem~ done ''; } From 04b49f4e8d44ccd9f13b58ac4c31f8af4c28d4a1 Mon Sep 17 00:00:00 2001 From: Emily Date: Wed, 9 Apr 2025 15:25:59 +0100 Subject: [PATCH 2/4] apple-sdk: add hack for C++ issues on `x86_64-darwin` --- .../ap/apple-sdk/common/process-stubs.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix b/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix index 1720d9f27cd7..0f87f9c326bd 100644 --- a/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix +++ b/pkgs/by-name/ap/apple-sdk/common/process-stubs.nix @@ -38,5 +38,21 @@ self: super: { llvm-readtapi --filetype=tbd-v4 usr/lib/$libSystem~ -o usr/lib/$libSystem rm usr/lib/$libSystem~ done + + # Strip weak C++ symbols to work around `libc++` leakage in system + # frameworks for now. These are only present on `x86_64-darwin`, so + # it should hopefully be harmless. + # + # TODO FIXME: This is kind of horrible. + while read -r -d "" stub; do + printf 'Stripping weak C++ symbols from %s\n' "$stub" + llvm-readtapi --filetype=tbd-v5 "$stub" \ + | jq ' + (.main_library, .libraries[]?).exported_symbols[]?.data.weak[]? |= + select(startswith("__Z") | not) + ' > $stub~ + llvm-readtapi --filetype=tbd-v4 $stub~ -o $stub + rm $stub~ + done < <(find . -name '*.tbd' -print0) ''; } From 9e75b2565365cccc93a1b5512ed2d16d1765ac19 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 22 Apr 2025 00:10:26 +0100 Subject: [PATCH 3/4] opencv4: revert Darwin SDK workaround No longer necessary. This partially reverts commit 12f58047cd1036b2fc4b94152de467810bd07f41. --- pkgs/development/libraries/opencv/4.x.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/development/libraries/opencv/4.x.nix b/pkgs/development/libraries/opencv/4.x.nix index 0b57a0bbf336..04e49c7fdcd4 100644 --- a/pkgs/development/libraries/opencv/4.x.nix +++ b/pkgs/development/libraries/opencv/4.x.nix @@ -88,7 +88,6 @@ enabledModules ? [ ], bzip2, - apple-sdk_14, # earlier SDKs cause linking issues on x86_64 callPackage, }@inputs: @@ -417,7 +416,6 @@ effectiveStdenv.mkDerivation { ] ++ optionals effectiveStdenv.hostPlatform.isDarwin [ bzip2 - apple-sdk_14 ] ++ optionals enableDocs [ doxygen From cb004b01257f130baecbd27ce0bf6c449ccbdf75 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 22 Apr 2025 00:09:29 +0100 Subject: [PATCH 4/4] qt5: remove obsolete Darwin SDK comment This partially reverts commit 6b77ed4b187da1d42ec4ee727bcdd9d62baa6db3. --- pkgs/development/libraries/qt-5/modules/qtbase.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix index 0e55f0944cee..e9be662ab6d4 100644 --- a/pkgs/development/libraries/qt-5/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix @@ -88,7 +88,6 @@ let throw "Please add a qtPlatformCross entry for ${plat.config}"; # Per https://doc.qt.io/qt-5/macos.html#supported-versions: build SDK = 13.x or 14.x. - # SDK 13.x causes weird linking errors on x86_64-darwin, so use 14.x darwinVersionInputs = [ apple-sdk_14 ];