From 1c1ce083f7d97e72dc11e8a127091f2f9ddebd7f Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 30 Oct 2023 22:20:37 -0400 Subject: [PATCH 1/3] qt6.qtwebengine: fix QtWebEngine build crash QtWebEngine tries to build with clang 14, which links libc++ 14, but the top-level libc++ on Dariwn is libc++ 16. This results in a crash during the build, which is fixed by building with the default stdenv. --- pkgs/development/libraries/qt-6/default.nix | 2 +- pkgs/development/libraries/qt-6/modules/qtwebengine.nix | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index 6629f618a2e6..3372797051ab 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -141,7 +141,7 @@ let qtwebchannel = callPackage ./modules/qtwebchannel.nix { }; qtwebengine = callPackage ./modules/qtwebengine.nix { inherit (darwin) bootstrap_cmds cctools xnu; - inherit (darwin.apple_sdk_11_0) libpm libunwind llvmPackages_14; + inherit (darwin.apple_sdk_11_0) libpm libunwind; inherit (darwin.apple_sdk_11_0.libs) sandbox; inherit (darwin.apple_sdk_11_0.frameworks) AGL AVFoundation Accelerate Cocoa CoreLocation CoreML ForceFeedback diff --git a/pkgs/development/libraries/qt-6/modules/qtwebengine.nix b/pkgs/development/libraries/qt-6/modules/qtwebengine.nix index 8670fba6bb2a..4b4172897e08 100644 --- a/pkgs/development/libraries/qt-6/modules/qtwebengine.nix +++ b/pkgs/development/libraries/qt-6/modules/qtwebengine.nix @@ -60,7 +60,6 @@ , mesa , enableProprietaryCodecs ? true # darwin -, llvmPackages_14 , bootstrap_cmds , cctools , xcbuild @@ -106,7 +105,6 @@ qtModule { gn nodejs ] ++ lib.optionals stdenv.isDarwin [ - llvmPackages_14.clang bootstrap_cmds cctools xcbuild From 3440df992e8ae2ae592b4359064765811e1ad2bd Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 31 Oct 2023 00:14:59 -0400 Subject: [PATCH 2/3] stdenvAdapters.overrideSDK: override xcodebuild to use the requested SDK --- pkgs/stdenv/adapters.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index a7985b474ed7..dd3dcfd6f3ac 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -323,8 +323,27 @@ rec { then sdk.frameworks."${framework}" else replacePropagatedFrameworks pkg; + mapRuntimeToSDK = pkg: + # Only remap xcbuild for now, which exports the SDK used to build it. + if pkg != null && lib.getName pkg == "xcodebuild" + then pkg.override { stdenv = overrideSDK stdenv { inherit darwinMinVersion darwinSdkVersion; }; } + else pkg; + mapInputsToSDK = inputs: args: - lib.genAttrs inputs (input: map mapPackageToSDK (args."${input}" or [ ])); + let + runsAtBuild = lib.flip lib.elem [ + "depsBuildBuild" + "depsBuildBuildPropagated" + "nativeBuildInputs" + "propagatedNativeBuildInputs" + "depsBuildTarget" + "depsBuildTargetPropagated" + ]; + atBuildInputs = lib.filter runsAtBuild inputs; + atRuntimeInputs = lib.subtractLists atBuildInputs inputs; + in + lib.genAttrs atRuntimeInputs (input: map mapPackageToSDK (args."${input}" or [ ])) + // lib.genAttrs atBuildInputs (input: map mapRuntimeToSDK (args."${input}" or [ ])); mkCC = cc: cc.override { bintools = cc.bintools.override { libc = sdk.Libsystem; }; @@ -343,6 +362,8 @@ rec { extraBuildInputs = [sdk.frameworks.CoreFoundation ]; mkDerivationFromStdenv = extendMkDerivationArgs old (mapInputsToSDK [ "buildInputs" + "nativeBuildInputs" + "propagatedNativeBuildInputs" ]); }); } From 3f3a594249877179c5395ac74d4625a5f0c23e4c Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Mon, 30 Oct 2023 23:24:52 -0400 Subject: [PATCH 3/3] qt6.qtwebengine: fix build with clang 16 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specify a deployment target of 10.13 to avoid errors due to clang’s having a hard-coded check for 10.13 when using them (even though it implements them with `posix_memalign`, which is available on earlier versions of macOS). --- pkgs/development/libraries/qt-6/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index 3372797051ab..987e31b9ed54 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -9,6 +9,7 @@ , gst_all_1 , libglvnd , darwin +, overrideSDK , buildPackages , python3 @@ -148,6 +149,11 @@ let GameController ImageCaptureCore LocalAuthentication MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz ReplayKit SecurityInterface Vision; + qtModule = qtModule.override { + stdenv = if stdenv.isDarwin + then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; } + else stdenv; + }; xcbuild = buildPackages.xcbuild.override { productBuildVer = "20A2408"; };