From 555f300879332a5989c1130b8e78bf8bdbac20ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 5 Feb 2023 14:56:47 +0100 Subject: [PATCH] treewide: another round of gcc12 fixups --- pkgs/applications/audio/bespokesynth/default.nix | 4 ++++ pkgs/applications/audio/stochas/default.nix | 5 +++++ pkgs/applications/office/gnucash/default.nix | 5 +++++ pkgs/applications/plasma-mobile/angelfish.nix | 4 ++-- pkgs/applications/plasma-mobile/audiotube.nix | 4 ++-- pkgs/applications/science/logic/cbmc/default.nix | 4 ++-- pkgs/applications/window-managers/cardboard/default.nix | 4 ++++ pkgs/development/tools/misc/edb/default.nix | 2 ++ pkgs/games/openmw/default.nix | 4 ++++ pkgs/games/stepmania/default.nix | 4 ++++ pkgs/games/supertux/default.nix | 4 ++++ pkgs/os-specific/linux/ocf-resource-agents/default.nix | 5 +++++ pkgs/os-specific/linux/projecteur/default.nix | 4 ++++ pkgs/tools/misc/yafetch/default.nix | 2 ++ pkgs/tools/networking/ip2unix/default.nix | 4 ++++ pkgs/tools/networking/uqmi/default.nix | 4 ++-- pkgs/tools/text/justify/default.nix | 4 ++++ pkgs/tools/text/qgrep/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 5 +++-- 19 files changed, 64 insertions(+), 12 deletions(-) diff --git a/pkgs/applications/audio/bespokesynth/default.nix b/pkgs/applications/audio/bespokesynth/default.nix index 6c48c756ab24..7fc921e59fbf 100644 --- a/pkgs/applications/audio/bespokesynth/default.nix +++ b/pkgs/applications/audio/bespokesynth/default.nix @@ -66,6 +66,10 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + postPatch = '' + sed '1i#include ' -i Source/TitleBar.h # gcc12 + ''; + cmakeBuildType = "Release"; cmakeFlags = lib.optionals enableVST2 [ "-DBESPOKE_VST2_SDK_LOCATION=${vst-sdk}/VST2_SDK" ]; diff --git a/pkgs/applications/audio/stochas/default.nix b/pkgs/applications/audio/stochas/default.nix index 84376a1bbe9e..2b72664347e6 100644 --- a/pkgs/applications/audio/stochas/default.nix +++ b/pkgs/applications/audio/stochas/default.nix @@ -12,6 +12,11 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + postPatch = '' + sed '1i#include ' -i \ + lib/JUCE/modules/juce_gui_basics/windows/juce_ComponentPeer.h # gcc12 + ''; + nativeBuildInputs = [ cmake pkg-config ]; buildInputs = [ diff --git a/pkgs/applications/office/gnucash/default.nix b/pkgs/applications/office/gnucash/default.nix index 700a94429964..f9e9ec57704c 100644 --- a/pkgs/applications/office/gnucash/default.nix +++ b/pkgs/applications/office/gnucash/default.nix @@ -80,6 +80,11 @@ stdenv.mkDerivation rec { # guile warning GUILE_AUTO_COMPILE="0"; + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but breaks on darwin (with clang) or older gcc + "-Wno-error=use-after-free" + ]; + # `make check` target does not define its prerequisites but expects them to # have already been built. The list of targets below was built through trial # and error based on failing tests. diff --git a/pkgs/applications/plasma-mobile/angelfish.nix b/pkgs/applications/plasma-mobile/angelfish.nix index 8158e4d6ea6e..036cf54173ee 100644 --- a/pkgs/applications/plasma-mobile/angelfish.nix +++ b/pkgs/applications/plasma-mobile/angelfish.nix @@ -3,7 +3,7 @@ , cmake , corrosion , extra-cmake-modules -, gcc11 +, gcc12 , kconfig , kcoreaddons , kdbusaddons @@ -45,7 +45,7 @@ mkDerivation rec { cmake corrosion extra-cmake-modules - gcc11 # doesn't build with GCC 9 from stdenv on aarch64 + gcc12 # doesn't build with GCC 9 from stdenv on aarch64 ] ++ (with rustPlatform; [ cargoSetupHook rust.cargo diff --git a/pkgs/applications/plasma-mobile/audiotube.nix b/pkgs/applications/plasma-mobile/audiotube.nix index cb87fe0ed24d..14bfc6d18917 100644 --- a/pkgs/applications/plasma-mobile/audiotube.nix +++ b/pkgs/applications/plasma-mobile/audiotube.nix @@ -2,7 +2,7 @@ , mkDerivation , extra-cmake-modules -, gcc11 +, gcc12 , wrapGAppsHook , gst_all_1 @@ -22,7 +22,7 @@ mkDerivation rec { nativeBuildInputs = [ extra-cmake-modules wrapGAppsHook - gcc11 # doesn't build with GCC 9 from stdenv on aarch64 + gcc12 # doesn't build with GCC 9 from stdenv on aarch64 python3Packages.wrapPython python3Packages.pybind11 ]; diff --git a/pkgs/applications/science/logic/cbmc/default.nix b/pkgs/applications/science/logic/cbmc/default.nix index 7f15a5f8809a..718022b36ef2 100644 --- a/pkgs/applications/science/logic/cbmc/default.nix +++ b/pkgs/applications/science/logic/cbmc/default.nix @@ -60,8 +60,8 @@ stdenv.mkDerivation rec { --prefix PATH : "$out/share/cbmc" \ ''; - NIX_CFLAGS_COMPILE = [ - # Needed with GCC 12 + NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [ + # Needed with GCC 12 but breaks on darwin (with clang) "-Wno-error=maybe-uninitialized" ] ++ lib.optionals stdenv.cc.isClang [ # fix "argument unused during compilation" diff --git a/pkgs/applications/window-managers/cardboard/default.nix b/pkgs/applications/window-managers/cardboard/default.nix index 5347b0961a54..6e483a40ef51 100644 --- a/pkgs/applications/window-managers/cardboard/default.nix +++ b/pkgs/applications/window-managers/cardboard/default.nix @@ -99,6 +99,8 @@ stdenv.mkDerivation rec { cp -r ${expected-wrap} ${expected-wrap.name} cp -r ${wlroots-wrap} ${wlroots-wrap.name} ) + + sed '1i#include ' -i cardboard/ViewAnimation.h # gcc12 ''; # "Inherited" from Nixpkgs expression for wlroots @@ -108,6 +110,8 @@ stdenv.mkDerivation rec { "-Dwlroots:libseat=disabled" ]; + NIX_CFLAGS_COMPILE = [ "-Wno-error=array-bounds" ]; # gcc12 + meta = with lib; { homepage = "https://gitlab.com/cardboardwm/cardboard"; description = "A scrollable, tiling Wayland compositor inspired on PaperWM"; diff --git a/pkgs/development/tools/misc/edb/default.nix b/pkgs/development/tools/misc/edb/default.nix index ec65ca62fa30..2203863264f3 100644 --- a/pkgs/development/tools/misc/edb/default.nix +++ b/pkgs/development/tools/misc/edb/default.nix @@ -30,6 +30,8 @@ mkDerivation rec { # Change default optional terminal program path to one that is more likely to work on NixOS. substituteInPlace ./src/Configuration.cpp --replace "/usr/bin/xterm" "xterm"; + + sed '1i#include ' -i include/{RegisterViewModelBase,State,IState}.h # gcc12 ''; meta = with lib; { diff --git a/pkgs/games/openmw/default.nix b/pkgs/games/openmw/default.nix index 389f59f91a6a..8df88c92ff1c 100644 --- a/pkgs/games/openmw/default.nix +++ b/pkgs/games/openmw/default.nix @@ -63,6 +63,10 @@ mkDerivation rec { }) ]; + postPatch = '' + sed '1i#include ' -i components/myguiplatform/myguidatamanager.cpp # gcc12 + ''; + nativeBuildInputs = [ cmake pkg-config wrapQtAppsHook ]; buildInputs = [ diff --git a/pkgs/games/stepmania/default.nix b/pkgs/games/stepmania/default.nix index 2445ee9096c9..6cb7a23dff5f 100644 --- a/pkgs/games/stepmania/default.nix +++ b/pkgs/games/stepmania/default.nix @@ -18,6 +18,10 @@ stdenv.mkDerivation rec { ./0001-fix-build-with-ffmpeg-4.patch ]; + postPatch = '' + sed '1i#include ' -i src/arch/ArchHooks/ArchHooks.h # gcc12 + ''; + nativeBuildInputs = [ cmake nasm ]; buildInputs = [ diff --git a/pkgs/games/supertux/default.nix b/pkgs/games/supertux/default.nix index 679500f974c3..857617bc4bfa 100644 --- a/pkgs/games/supertux/default.nix +++ b/pkgs/games/supertux/default.nix @@ -29,6 +29,10 @@ stdenv.mkDerivation rec { sha256 = "1xkr3ka2sxp5s0spp84iv294i29s1vxqzazb6kmjc0n415h0x57p"; }; + postPatch = '' + sed '1i#include ' -i external/partio_zip/zip_manager.hpp # gcc12 + ''; + nativeBuildInputs = [ pkg-config cmake ]; buildInputs = [ diff --git a/pkgs/os-specific/linux/ocf-resource-agents/default.nix b/pkgs/os-specific/linux/ocf-resource-agents/default.nix index 8d7f2b527144..976c5f1779d7 100644 --- a/pkgs/os-specific/linux/ocf-resource-agents/default.nix +++ b/pkgs/os-specific/linux/ocf-resource-agents/default.nix @@ -42,6 +42,11 @@ let python3 ]; + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but breaks on darwin (with clang) or older gcc + "-Wno-error=maybe-uninitialized" + ]; + meta = with lib; { homepage = "https://github.com/ClusterLabs/resource-agents"; description = "Combined repository of OCF agents from the RHCS and Linux-HA projects"; diff --git a/pkgs/os-specific/linux/projecteur/default.nix b/pkgs/os-specific/linux/projecteur/default.nix index 63de7453935c..ecb0fe535d35 100644 --- a/pkgs/os-specific/linux/projecteur/default.nix +++ b/pkgs/os-specific/linux/projecteur/default.nix @@ -13,6 +13,10 @@ mkDerivation rec { sha256 = "sha256-kg6oYtJ4H5A6RNATBg+XvMfCb9FlhEBFjfxamGosMQg="; }; + postPatch = '' + sed '1i#include ' -i src/device.h # gcc12 + ''; + buildInputs = [ qtbase qtgraphicaleffects ]; nativeBuildInputs = [ wrapQtAppsHook cmake pkg-config ]; diff --git a/pkgs/tools/misc/yafetch/default.nix b/pkgs/tools/misc/yafetch/default.nix index f55926d0ae39..4ebaea963c29 100644 --- a/pkgs/tools/misc/yafetch/default.nix +++ b/pkgs/tools/misc/yafetch/default.nix @@ -15,6 +15,8 @@ stdenv.mkDerivation rec { prePatch = '' substituteInPlace ./config.h --replace \ "#include \"ascii/gnu.h\"" "#include \"ascii/nixos.h\"" + + sed '1i#include ' -i config.h # gcc12 ''; # Fixes installation path diff --git a/pkgs/tools/networking/ip2unix/default.nix b/pkgs/tools/networking/ip2unix/default.nix index c4c03cae3a7f..fabbbb40e7a7 100644 --- a/pkgs/tools/networking/ip2unix/default.nix +++ b/pkgs/tools/networking/ip2unix/default.nix @@ -14,6 +14,10 @@ stdenv.mkDerivation rec { sha256 = "1pl8ayadxb0zzh5s26yschkjhr1xffbzzv347m88f9y0jv34d24r"; }; + postPatch = '' + sed '1i#include ' -i src/dynports/dynports.cc # gcc12 + ''; + nativeBuildInputs = [ meson ninja pkg-config asciidoc libxslt.bin docbook_xml_dtd_45 docbook_xsl libxml2.bin docbook5 python3Packages.pytest python3Packages.pytest-timeout diff --git a/pkgs/tools/networking/uqmi/default.nix b/pkgs/tools/networking/uqmi/default.nix index 93be3b78cee1..067bc51854ad 100644 --- a/pkgs/tools/networking/uqmi/default.nix +++ b/pkgs/tools/networking/uqmi/default.nix @@ -18,8 +18,8 @@ stdenv.mkDerivation { nativeBuildInputs = [ cmake perl ]; buildInputs = [ libubox json_c ]; - NIX_CFLAGS_COMPILE = [ - # Needed with GCC 12 + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but breaks on darwin (with clang) or older gcc "-Wno-error=dangling-pointer" ]; diff --git a/pkgs/tools/text/justify/default.nix b/pkgs/tools/text/justify/default.nix index 1e18e22db8e2..86de7365663e 100644 --- a/pkgs/tools/text/justify/default.nix +++ b/pkgs/tools/text/justify/default.nix @@ -16,6 +16,10 @@ stdenv.mkDerivation rec { sha256 = "sha256-406OhJt2Ila/LIhfqJXhbFqFxJJiRyMVI4/VK8Y43kc="; }; + postPatch = '' + sed '1i#include ' -i src/stringHelper.h # gcc12 + ''; + nativeBuildInputs = [ cmake ]; installPhase = '' diff --git a/pkgs/tools/text/qgrep/default.nix b/pkgs/tools/text/qgrep/default.nix index 20c85e76e160..4145ec656d20 100644 --- a/pkgs/tools/text/qgrep/default.nix +++ b/pkgs/tools/text/qgrep/default.nix @@ -21,8 +21,8 @@ stdenv.mkDerivation rec { buildInputs = lib.optionals stdenv.isDarwin [ CoreServices CoreFoundation ]; - NIX_CFLAGS_COMPILE = [ - # Needed with GCC 12 + NIX_CFLAGS_COMPILE = lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [ + # Needed with GCC 12 but breaks on darwin (with clang) or older gcc "-Wno-error=mismatched-new-delete" ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 760cfa4e56ab..cf8288b203c6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2532,7 +2532,7 @@ with pkgs; writefreely = callPackage ../applications/misc/writefreely { }; - iqueue = callPackage ../development/libraries/iqueue { stdenv = gcc10StdenvCompat; }; + iqueue = callPackage ../development/libraries/iqueue { }; lifecycled = callPackage ../tools/misc/lifecycled { }; @@ -15237,7 +15237,7 @@ with pkgs; mitama-cpp-result = callPackage ../development/libraries/mitama-cpp-result { }; mitscheme = callPackage ../development/compilers/mit-scheme - { stdenv = gcc10StdenvCompat; texLive = texlive.combine { inherit (texlive) scheme-small epsf texinfo; }; }; + { texLive = texlive.combine { inherit (texlive) scheme-small epsf texinfo; }; }; mitschemeX11 = mitscheme.override { enableX11 = true; @@ -17497,6 +17497,7 @@ with pkgs; libgcc = callPackage ../development/libraries/gcc/libgcc { stdenvNoLibs = gccStdenvNoLibs; # cannot be built with clang it seems + gcc = gcc11; # fails to build with gcc12 }; # This is for e.g. LLVM libraries on linux.