From cfc056287cb29a7bc434f0a2334b149f6a057094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 5 Feb 2023 18:34:47 +0100 Subject: [PATCH] treewide: another round of gcc12 fixups --- pkgs/applications/audio/odin2/default.nix | 5 +++++ pkgs/applications/misc/mysql-workbench/default.nix | 7 +++++-- pkgs/development/libraries/belle-sip/default.nix | 5 +++-- pkgs/development/libraries/maplibre-gl-native/default.nix | 5 +++++ pkgs/games/liquidwar/default.nix | 7 ++++--- pkgs/games/zod/default.nix | 7 +++++-- pkgs/tools/graphics/libyafaray/default.nix | 5 +++++ pkgs/tools/misc/mpdscribble/default.nix | 4 ++++ pkgs/tools/system/facter/default.nix | 4 ++++ pkgs/tools/system/rocm-smi/default.nix | 4 ++++ pkgs/top-level/all-packages.nix | 2 +- 11 files changed, 45 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/audio/odin2/default.nix b/pkgs/applications/audio/odin2/default.nix index beb126467935..de89f9aedead 100644 --- a/pkgs/applications/audio/odin2/default.nix +++ b/pkgs/applications/audio/odin2/default.nix @@ -28,6 +28,11 @@ stdenv.mkDerivation rec { sha256 = "sha256-N96Nb7G6hqfh8DyMtHbttl/fRZUkS8f2KfPSqeMAhHY="; }; + postPatch = '' + sed '1i#include ' -i \ + libs/JUCELV2/modules/juce_gui_basics/windows/juce_ComponentPeer.h # gcc12 + ''; + nativeBuildInputs = [ cmake pkg-config diff --git a/pkgs/applications/misc/mysql-workbench/default.nix b/pkgs/applications/misc/mysql-workbench/default.nix index 935a9582fcac..e5e0f92ed1da 100644 --- a/pkgs/applications/misc/mysql-workbench/default.nix +++ b/pkgs/applications/misc/mysql-workbench/default.nix @@ -140,13 +140,16 @@ in stdenv.mkDerivation rec { patchShebangs tools/get_wb_version.sh ''; - NIX_CFLAGS_COMPILE = toString ([ + NIX_CFLAGS_COMPILE = [ # error: 'OGRErr OGRSpatialReference::importFromWkt(char**)' is deprecated "-Wno-error=deprecated-declarations" ] ++ lib.optionals stdenv.isAarch64 [ # error: narrowing conversion of '-1' from 'int' to 'char' "-Wno-error=narrowing" - ]); + ] ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but problematic with some old GCCs + "-Wno-error=maybe-uninitalized" + ]; cmakeFlags = [ "-DMySQL_CONFIG_PATH=${mysql}/bin/mysql_config" diff --git a/pkgs/development/libraries/belle-sip/default.nix b/pkgs/development/libraries/belle-sip/default.nix index a33b9f163602..a76068548122 100644 --- a/pkgs/development/libraries/belle-sip/default.nix +++ b/pkgs/development/libraries/belle-sip/default.nix @@ -29,12 +29,13 @@ stdenv.mkDerivation rec { # Do not build static libraries cmakeFlags = [ "-DENABLE_STATIC=NO" ]; - NIX_CFLAGS_COMPILE = toString [ + NIX_CFLAGS_COMPILE = [ "-Wno-error=cast-function-type" "-Wno-error=deprecated-declarations" "-Wno-error=format-truncation" "-Wno-error=stringop-overflow" - # Needed with GCC 12 + ] ++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but problematic with some old GCCs and probably clang "-Wno-error=use-after-free" ]; diff --git a/pkgs/development/libraries/maplibre-gl-native/default.nix b/pkgs/development/libraries/maplibre-gl-native/default.nix index 568f3fbe64e2..9f9cb576c77f 100644 --- a/pkgs/development/libraries/maplibre-gl-native/default.nix +++ b/pkgs/development/libraries/maplibre-gl-native/default.nix @@ -55,6 +55,11 @@ mkDerivation rec { "-DMBGL_WITH_QT_HEADLESS=OFF" ]; + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but problematic with some old GCCs + "-Wno-error=use-after-free" + ]; + meta = with lib; { description = "Open-source alternative to Mapbox GL Native"; homepage = "https://maplibre.org/"; diff --git a/pkgs/games/liquidwar/default.nix b/pkgs/games/liquidwar/default.nix index a3532fa6e198..9d9e4243452c 100644 --- a/pkgs/games/liquidwar/default.nix +++ b/pkgs/games/liquidwar/default.nix @@ -30,11 +30,12 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ]; - NIX_CFLAGS_COMPILE = [ - "-Wno-error=deprecated-declarations" - # Needed with GCC 12 + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but problematic with some old GCCs "-Wno-error=address" "-Wno-error=use-after-free" + ] ++ [ + "-Wno-error=deprecated-declarations" # Avoid GL_GLEXT_VERSION double definition " -DNO_SDL_GLEXT" ]; diff --git a/pkgs/games/zod/default.nix b/pkgs/games/zod/default.nix index 737fed1e7f64..e0c2031dde25 100644 --- a/pkgs/games/zod/default.nix +++ b/pkgs/games/zod/default.nix @@ -22,6 +22,9 @@ let url = "mirror://sourceforge/zod/linux_releases/zod_linux-${version}.tar.gz"; sha256 = "017v96aflrv07g8j8zk9mq8f8rqxl5228rjff5blq8dxpsv1sx7h"; }; + postPatch = '' + sed '1i#include ' -i zod_src/common.cpp # gcc12 + ''; nativeBuildInputs = [ makeWrapper ]; @@ -37,7 +40,7 @@ let hardeningDisable = [ "format" ]; NIX_LDFLAGS = "-L${libmysqlclient}/lib/mysql"; zod_engine = stdenv.mkDerivation { - inherit version src nativeBuildInputs buildInputs hardeningDisable NIX_LDFLAGS; + inherit version src postPatch nativeBuildInputs buildInputs hardeningDisable NIX_LDFLAGS; pname = "${name}-engine"; enableParallelBuilding = true; preBuild = "cd zod_src"; @@ -48,7 +51,7 @@ let ''; }; zod_map_editor = stdenv.mkDerivation { - inherit version src nativeBuildInputs buildInputs hardeningDisable NIX_LDFLAGS; + inherit version src postPatch nativeBuildInputs buildInputs hardeningDisable NIX_LDFLAGS; pname = "${name}-map_editor"; enableParallelBuilding = true; preBuild = "cd zod_src"; diff --git a/pkgs/tools/graphics/libyafaray/default.nix b/pkgs/tools/graphics/libyafaray/default.nix index db48aa678cc5..22bbfddbcf5d 100644 --- a/pkgs/tools/graphics/libyafaray/default.nix +++ b/pkgs/tools/graphics/libyafaray/default.nix @@ -26,6 +26,11 @@ stdenv.mkDerivation rec { sha256 = "sha256-UVBA1vXOuLg4RT+BdF4rhbZ6I9ySeZX0N81gh3MH84I="; }; + postPatch = '' + sed '1i#include ' -i \ + include/geometry/poly_double.h include/noise/noise_generator.h # gcc12 + ''; + preConfigure = '' NIX_CFLAGS_COMPILE+=" -isystem ${ilmbase.dev}/include/OpenEXR" ''; diff --git a/pkgs/tools/misc/mpdscribble/default.nix b/pkgs/tools/misc/mpdscribble/default.nix index dc446d3f0a19..46bf31ed667e 100644 --- a/pkgs/tools/misc/mpdscribble/default.nix +++ b/pkgs/tools/misc/mpdscribble/default.nix @@ -28,6 +28,10 @@ stdenv.mkDerivation rec { sha256 = "sha256-3wLfQvbwx+OFrCl5vMV7Zps4e4iEYFhqPiVCo5hDqgw="; })]; + postPatch = '' + sed '1i#include ' -i src/Log.cxx # gcc12 + ''; + nativeBuildInputs = [ pkg-config meson ninja ]; buildInputs = [ libmpdclient diff --git a/pkgs/tools/system/facter/default.nix b/pkgs/tools/system/facter/default.nix index de4acffa63e4..0e746b0d07a4 100644 --- a/pkgs/tools/system/facter/default.nix +++ b/pkgs/tools/system/facter/default.nix @@ -11,6 +11,10 @@ stdenv.mkDerivation rec { owner = "puppetlabs"; }; + postPatch = '' + sed '1i#include ' -i lib/src/facts/glib/load_average_resolver.cc # gcc12 + ''; + CXXFLAGS = lib.optionalString stdenv.cc.isGNU "-fpermissive -Wno-error=catch-value"; NIX_LDFLAGS = lib.optionalString stdenv.isLinux "-lblkid"; diff --git a/pkgs/tools/system/rocm-smi/default.nix b/pkgs/tools/system/rocm-smi/default.nix index 47542d25370d..d7e23a9acb01 100644 --- a/pkgs/tools/system/rocm-smi/default.nix +++ b/pkgs/tools/system/rocm-smi/default.nix @@ -17,6 +17,10 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-nkidiDNNU6MGhne9EbYClkODJZw/zZu3LWzlniJKyJE="; }; + postPatch = '' + sed '1i#include ' -i src/rocm_smi{,_gpu_metrics}.cc # since gcc12 probably + ''; + nativeBuildInputs = [ cmake wrapPython ]; patches = [ ./cmake.patch ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cf8288b203c6..4a4f706c4c0a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26358,7 +26358,7 @@ with pkgs; pipework = callPackage ../os-specific/linux/pipework { }; - pktgen = callPackage ../os-specific/linux/pktgen { stdenv = gcc10StdenvCompat; }; + pktgen = callPackage ../os-specific/linux/pktgen { }; plymouth = callPackage ../os-specific/linux/plymouth { };