From d7411c12c12eb6ffbae9d31870f6373553ea4ae1 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Tue, 23 May 2023 22:14:58 -0400 Subject: [PATCH 1/2] qt5.qtbase: fix build after Darwin stdenv bump When the Darwin stdenv is updated to LLVM 15+, it will switch to cctools-llvm. The ranlib it provides does not require `-no_warning_for_no_symbols` or support `-s`. --- .../libraries/qt-5/5.15/default.nix | 3 +++ .../0015-cctools-llvm-ranlib.patch | 23 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0015-cctools-llvm-ranlib.patch diff --git a/pkgs/development/libraries/qt-5/5.15/default.nix b/pkgs/development/libraries/qt-5/5.15/default.nix index 5f82900903835..9caa514ce7636 100644 --- a/pkgs/development/libraries/qt-5/5.15/default.nix +++ b/pkgs/development/libraries/qt-5/5.15/default.nix @@ -36,6 +36,9 @@ let ./qtbase.patch.d/0012-qtbase-tbd-frameworks.patch ./qtbase.patch.d/0014-aarch64-darwin.patch + ] ++ lib.optionals (stdenv.isDarwin && lib.hasPrefix "cctools-llvm" (lib.getName darwin.cctools)) [ + # When the Darwin stdenv uses llvm-ranlib, it does not support/need -no_warning_for_no_symbols + ./qtbase.patch.d/0015-cctools-llvm-ranlib.patch ] ++ [ ./qtbase.patch.d/0003-qtbase-mkspecs.patch ./qtbase.patch.d/0004-qtbase-replace-libdir.patch diff --git a/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0015-cctools-llvm-ranlib.patch b/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0015-cctools-llvm-ranlib.patch new file mode 100644 index 0000000000000..c07abbb019f7f --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0015-cctools-llvm-ranlib.patch @@ -0,0 +1,23 @@ +diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf +index 61bea952b2..eb7622974a 100644 +--- a/mkspecs/common/mac.conf ++++ b/mkspecs/common/mac.conf +@@ -47,5 +47,5 @@ QMAKE_STRIP = $${CROSS_COMPILE}strip + QMAKE_STRIPFLAGS_LIB += -S -x + + QMAKE_AR = $${CROSS_COMPILE}ar cq +-QMAKE_RANLIB = $${CROSS_COMPILE}ranlib -s ++QMAKE_RANLIB = $${CROSS_COMPILE}ranlib + QMAKE_NM = $${CROSS_COMPILE}nm -P +diff --git a/mkspecs/features/mac/no_warn_empty_obj_files.prf b/mkspecs/features/mac/no_warn_empty_obj_files.prf +index 598938ab12..7d75fa566d 100644 +--- a/mkspecs/features/mac/no_warn_empty_obj_files.prf ++++ b/mkspecs/features/mac/no_warn_empty_obj_files.prf +@@ -1,7 +1,2 @@ +-# Prevent warnings about object files without any symbols. This is a common +-# thing in Qt as we tend to build files unconditionally, and then use ifdefs +-# to compile out parts that are not relevant. +-QMAKE_RANLIB += -no_warning_for_no_symbols +- + # We have to tell 'ar' to not run ranlib by itself + QMAKE_AR += -S From 6ecffa5c61409f91af6f4ed227489a13adb2e549 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 24 May 2023 19:50:53 -0400 Subject: [PATCH 2/2] qt6.qtbase: fix build after Darwin stdenv bump When the Darwin stdenv is updated to LLVM 15+, it will switch to cctools-llvm. The ranlib it provides does not require `-no_warning_for_no_symbols` or support `-s`. --- pkgs/development/libraries/qt-6/default.nix | 3 +++ .../0008-qtbase-cctools-llvm-ranlib.patch | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/development/libraries/qt-6/patches/0008-qtbase-cctools-llvm-ranlib.patch diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index 0f164fb3ce022..8586dd64b2e9c 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -48,6 +48,9 @@ let ./patches/0005-qtbase-deal-with-a-font-face-at-index-0-as-Regular-f.patch ./patches/0006-qtbase-qt-cmake-always-use-cmake-from-path.patch ./patches/0007-qtbase-find-qt-tools-in-QTTOOLSPATH.patch + ] ++ lib.optionals (stdenv.isDarwin && lib.hasPrefix "cctools-llvm" (lib.getName darwin.cctools)) [ + # When the Darwin stdenv uses llvm-ranlib, it does not support/need -no_warning_for_no_symbols + ./patches/0008-qtbase-cctools-llvm-ranlib.patch ]; }; env = callPackage ./qt-env.nix { }; diff --git a/pkgs/development/libraries/qt-6/patches/0008-qtbase-cctools-llvm-ranlib.patch b/pkgs/development/libraries/qt-6/patches/0008-qtbase-cctools-llvm-ranlib.patch new file mode 100644 index 0000000000000..64c213b675a8e --- /dev/null +++ b/pkgs/development/libraries/qt-6/patches/0008-qtbase-cctools-llvm-ranlib.patch @@ -0,0 +1,25 @@ +diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake +index 1469abf176..b57dbc49e8 100644 +--- a/cmake/QtBuild.cmake ++++ b/cmake/QtBuild.cmake +@@ -431,7 +431,7 @@ if(CMAKE_HOST_APPLE AND APPLE) + # We have to tell 'ar' to not run ranlib by itself, by passing the 'S' option + set(CMAKE_${lang}_ARCHIVE_CREATE " qcS ") + set(CMAKE_${lang}_ARCHIVE_APPEND " qS ") +- set(CMAKE_${lang}_ARCHIVE_FINISH " -no_warning_for_no_symbols ") ++ set(CMAKE_${lang}_ARCHIVE_FINISH " ") + endforeach() + endif() + +diff --git a/mkspecs/features/mac/no_warn_empty_obj_files.prf b/mkspecs/features/mac/no_warn_empty_obj_files.prf +index 598938ab12..7d75fa566d 100644 +--- a/mkspecs/features/mac/no_warn_empty_obj_files.prf ++++ b/mkspecs/features/mac/no_warn_empty_obj_files.prf +@@ -1,7 +1,2 @@ +-# Prevent warnings about object files without any symbols. This is a common +-# thing in Qt as we tend to build files unconditionally, and then use ifdefs +-# to compile out parts that are not relevant. +-QMAKE_RANLIB += -no_warning_for_no_symbols +- + # We have to tell 'ar' to not run ranlib by itself + QMAKE_AR += -S