From fa21ebc82575a4e5d9f8d3b44f46fbae94c06ea4 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 21 Oct 2023 17:26:45 -0400 Subject: [PATCH 1/2] invidious: fix build with clang 16 Suppress warnings that cause build failures with newer clang versions. --- pkgs/servers/invidious/lsquic.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/invidious/lsquic.nix b/pkgs/servers/invidious/lsquic.nix index c9cdd9958ede..918882968b7a 100644 --- a/pkgs/servers/invidious/lsquic.nix +++ b/pkgs/servers/invidious/lsquic.nix @@ -57,7 +57,20 @@ let preBuild = preBuild + lib.optionalString stdenv.isLinux '' sed -e '/^build crypto\/fipsmodule\/CMakeFiles\/fipsmodule\.dir\/bcm\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=stringop-overflow/' \ -i build.ninja - ''; + '' + lib.optionalString stdenv.cc.isClang ( + # Silence warnings that cause build failures with newer versions of clang. + let + clangVersion = lib.getVersion stdenv.cc; + in + lib.optionalString (lib.versionAtLeast clangVersion "13") '' + sed -e '/^build crypto\/CMakeFiles\/crypto\.dir\/x509\/t_x509\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=unused-but-set-variable/' \ + -e '/^build tool\/CMakeFiles\/bssl\.dir\/digest\.cc\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=unused-but-set-variable/' \ + -i build.ninja + '' + lib.optionalString (lib.versionAtLeast clangVersion "16") '' + sed -e '/^build crypto\/CMakeFiles\/crypto\.dir\/trust_token\/trust_token\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=single-bit-bitfield-constant-conversion/' \ + -i build.ninja + '' + ); }); in stdenv.mkDerivation rec { From 523d3f143c6a361d5a5ceea39be100885c61ad54 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sun, 22 Oct 2023 20:47:18 -0400 Subject: [PATCH 2/2] invidious: fix build with GCC --- pkgs/servers/invidious/lsquic.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/servers/invidious/lsquic.nix b/pkgs/servers/invidious/lsquic.nix index 918882968b7a..9c88ae004aab 100644 --- a/pkgs/servers/invidious/lsquic.nix +++ b/pkgs/servers/invidious/lsquic.nix @@ -57,6 +57,11 @@ let preBuild = preBuild + lib.optionalString stdenv.isLinux '' sed -e '/^build crypto\/fipsmodule\/CMakeFiles\/fipsmodule\.dir\/bcm\.c\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=stringop-overflow/' \ -i build.ninja + '' + lib.optionalString stdenv.cc.isGNU '' + # Silence warning that causes build failures with GCC. + sed -e '/^build ssl\/test\/CMakeFiles\/bssl_shim\.dir\/settings_writer\.cc\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=ignored-attributes/' \ + -e '/^build ssl\/test\/CMakeFiles\/handshaker\.dir\/settings_writer\.cc\.o:/,/^ *FLAGS =/ s/^ *FLAGS = -Werror/& -Wno-error=ignored-attributes/' \ + -i build.ninja '' + lib.optionalString stdenv.cc.isClang ( # Silence warnings that cause build failures with newer versions of clang. let