treewide: add gcc12 flags

This commit is contained in:
Fabián Heredia Montiel 2022-12-23 10:57:29 -06:00
parent 413920705e
commit 0cf5d85f0c
55 changed files with 289 additions and 15 deletions

View File

@ -18,6 +18,12 @@ stdenv.mkDerivation rec {
lv2 libX11 libGL libGLU mesa
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
"-Wno-error=stringop-overflow"
];
installPhase = ''
mkdir -p $out/lib/lv2
cp -r aether.lv2 $out/lib/lv2

View File

@ -63,6 +63,12 @@ stdenv.mkDerivation rec {
"-DWARNINGS_ARE_ERRORS=ON"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=mismatched-new-delete"
"-Wno-error=use-after-free"
];
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
# Normal CMake install phase on Darwin only installs the binary, the user is expected to use CPack to build a
# bundle. That adds alot of overhead for not much benefit (CPack is currently abit broken, and needs impure access

View File

@ -38,6 +38,11 @@ stdenv.mkDerivation rec {
pcre2
] ++ lib.optional pulseaudioSupport libpulseaudio;
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=free-nonheap-object"
];
postInstall = ''
wrapProgram $out/bin/mimic \
--run "export ALSA_PLUGIN_DIR=${alsa-plugins}/lib/alsa-lib"

View File

@ -117,6 +117,10 @@ stdenv.mkDerivation rec {
--subst-var-by mamePath "$out/opt/mame"
'';
NIX_CFLAGS_COMPILE = [
"-Wno-error=use-after-free"
];
desktopItems = [
(makeDesktopItem {
name = "MAME";

View File

@ -46,6 +46,11 @@ stdenv.mkDerivation rec {
++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 libXrandr libXinerama libXcursor libXi libXext alsa-lib fontconfig libGLU ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ AVFoundation Carbon Cocoa CoreAudio Kernel OpenGL ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
installPhase = ''
runHook preInstall

View File

@ -16,6 +16,12 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ scons pkg-config wrapGAppsHook ];
buildInputs = [ glfw3 gtk3 libpng12 ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=format-truncation"
];
NIX_LDFLAGS = "-lpthread";
buildPhase = ''

View File

@ -19,6 +19,11 @@ stdenv.mkDerivation rec {
sha256 = "sha256-VaUr63v7mzhh4VBghH7a7qrqOYwl6vucmmKzTi9yAjY=";
}) ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
];
postInstall = ''
mkdir $out/bin
mv $out/octopus $out/bin

View File

@ -60,9 +60,13 @@ stdenv.mkDerivation rec {
--prefix PATH : "$out/share/cbmc" \
'';
# fix "argument unused during compilation"
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang
"-Wno-unused-command-line-argument";
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
] ++ lib.optionals stdenv.cc.isClang [
# fix "argument unused during compilation"
"-Wno-unused-command-line-argument"
];
# TODO: add jbmc support
cmakeFlags = [ "-DWITH_JBMC=OFF" "-Dsat_impl=cadical" "-Dcadical_INCLUDE_DIR=${cadical.dev}/include" ];

View File

@ -54,6 +54,12 @@ stdenv.mkDerivation rec {
] else [ "-DUSE_CUDA=OFF" ])
++ lib.optional (!cudnnSupport) "-DUSE_CUDNN=OFF";
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
"-Wno-error=uninitialized"
];
postPatch = ''
substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \
--replace "/bin/bash" "${bash}/bin/bash"

View File

@ -13,6 +13,11 @@ stdenv.mkDerivation rec {
makeFlags = [ "PREFIX=$(out)" ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
];
preInstall = ''
mkdir -p $out/bin
'';

View File

@ -49,6 +49,12 @@ stdenv.mkDerivation {
runHook postConfigure
'';
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-parameter"
"-Wno-error=use-after-free"
];
buildPhase = ''
runHook preBuild
cd src

View File

@ -33,6 +33,11 @@ stdenv.mkDerivation rec {
-L${sqlite.out}/lib";
'';
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=use-after-free"
];
# Be sure to keep the statically linked libraries
dontDisableStatic = true;

View File

@ -21,6 +21,10 @@ stdenv.mkDerivation rec {
"-Wno-error=maybe-uninitialized"
# Needed with GCC 11
"-Wno-error=misleading-indentation"
# Needed with GCC 12
"-Wno-error=nonnull"
"-Wno-error=stringop-overflow"
"-Wno-error=use-after-free"
]) ++ optional stdenv.cc.isClang "-Wno-error=null-dereference");
patchPhase = lib.optionalString stdenv.isDarwin ''

View File

@ -23,6 +23,11 @@ stdenv.mkDerivation rec {
cmakeFlags = [ "-DASSIMP_BUILD_ASSIMP_TOOLS=ON" ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
meta = with lib; {
description = "A library to import various 3D model formats";
homepage = "https://www.assimp.org/";

View File

@ -34,6 +34,8 @@ stdenv.mkDerivation rec {
"-Wno-error=deprecated-declarations"
"-Wno-error=format-truncation"
"-Wno-error=stringop-overflow"
# Needed with GCC 12
"-Wno-error=use-after-free"
];
propagatedBuildInputs = [ libantlr3c mbedtls_2 bctoolbox belr ];

View File

@ -30,6 +30,11 @@ buildGoModule {
export GOARCH=$(go env GOHOSTARCH)
'';
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=stringop-overflow"
];
buildPhase = ''
ninjaBuildPhase
'';

View File

@ -25,6 +25,11 @@ stdenv.mkDerivation rec {
# Do not build static libraries
cmakeFlags = [ "-DENABLE_STATIC=NO" "-DCMAKE_C_FLAGS=-Wno-error=cast-function-type" ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=stringop-overflow"
];
meta = with lib; {
description = "An opensource implementation of ZRTP keys exchange protocol. Part of the Linphone project.";
homepage = "https://gitlab.linphone.org/BC/public/bzrtp";

View File

@ -24,6 +24,8 @@ stdenv.mkDerivation {
NIX_CFLAGS_COMPILE = [
"-Wno-error=range-loop-construct"
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
];
meta = with lib; {

View File

@ -2,13 +2,21 @@
stdenv.mkDerivation rec {
pname = "gsmlib";
version = "unstable-2017-10-06";
src = fetchFromGitHub {
owner = "x-logLT";
repo = "gsmlib";
rev = "4f794b14450132f81673f7d3570c5a859aecf7ae";
sha256 = "16v8aj914ac1ipf14a867ljib3gy7fhzd9ypxnsg9l0zi8mm3ml5";
};
nativeBuildInputs = [ autoreconfHook ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-std=c++14"
];
meta = with lib; {
description = "Library to access GSM mobile phones through GSM modems";
homepage = "https://github.com/x-logLT/gsmlib";

View File

@ -12,6 +12,12 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libbsd microsoft_gsl ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-parameter"
"-Wno-error=misleading-indentation"
];
meta = with lib; {
homepage = "https://github.com/twosigma/iqueue";
description = "Indexed queue";

View File

@ -46,6 +46,11 @@ in stdenv.mkDerivation rec {
"-DBLADERF_GROUP=bladerf"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
hardeningDisable = [ "fortify" ];
meta = with lib; {

View File

@ -24,6 +24,11 @@ stdenv.mkDerivation rec {
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" "AR=${stdenv.cc.targetPrefix}ar" "PREFIX=$(out)" ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=address"
];
meta = with lib; {
description = "Emulate a Cisco-style telnet command-line interface";
homepage = "http://sites.dparrish.com/libcli";

View File

@ -15,14 +15,17 @@ stdenv.mkDerivation rec {
"-DDYND_BUILD_BENCHMARKS=OFF"
];
# added to fix build with gcc7+
NIX_CFLAGS_COMPILE = builtins.toString [
# added to fix build with gcc7+
"-Wno-error=implicit-fallthrough"
"-Wno-error=nonnull"
"-Wno-error=tautological-compare"
"-Wno-error=class-memaccess"
"-Wno-error=parentheses"
"-Wno-error=deprecated-copy"
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
"-Wno-error=maybe-uninitialized"
];
nativeBuildInputs = [ cmake ];

View File

@ -19,6 +19,11 @@ stdenv.mkDerivation rec {
"--with-x-locale-root=${libX11.out}/share/X11/locale"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
preBuild = lib.optionalString stdenv.isDarwin ''
sed -i 's/,--version-script=.*$//' Makefile
'';

View File

@ -10,10 +10,16 @@ stdenv.mkDerivation rec {
rev = "v${version}";
hash = "sha256-qE5i4dGugm7tR5tgDCpbla/R7hYR/PI8BzrZQ4y6Yz8=";
};
sourceRoot = "source/octomap";
nativeBuildInputs = [ cmake ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
];
meta = with lib; {
description = "A probabilistic, flexible, and compact 3D mapping library for robotic systems";
homepage = "https://octomap.github.io/";

View File

@ -19,6 +19,11 @@ stdenv.mkDerivation rec {
buildInputs = [ readline libmysqlclient postgresql sqlite ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-std=c++14"
];
meta = with lib; {
broken = stdenv.isDarwin;
description = "Extremely lightweight but extensible database access library written in C";

View File

@ -36,8 +36,16 @@ stdenv.mkDerivation rec {
"tools"
];
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=deprecated-copy -Wno-error=pessimizing-move"
+ lib.optionalString stdenv.cc.isClang "-Wno-error=unused-private-field -faligned-allocation";
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
"-Wno-error=deprecated-copy"
"-Wno-error=pessimizing-move"
# Needed with GCC 12
"-Wno-error=format-truncation"
"-Wno-error=maybe-uninitialized"
] ++ lib.optionals stdenv.cc.isClang [
"-Wno-error=unused-private-field"
"-faligned-allocation"
];
cmakeFlags = [
"-DPORTABLE=1"

View File

@ -62,6 +62,11 @@ stdenv.mkDerivation (finalAttrs: {
"-DCMAKE_INSTALL_INCLUDEDIR=include"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
postPatch = ''
export HIP_DEVICE_LIB_PATH=${rocm-device-libs}/amdgcn/bitcode
'' + lib.optionalString (!buildTests) ''

View File

@ -13,6 +13,12 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake python3 jq ];
buildInputs = [ libX11 libXext zlib ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
"-Wno-error=uninitialized"
];
# Make sure we include the drivers and icd files in the output as the cmake
# generated install command only puts in the spirv-tools stuff.
installPhase = ''

View File

@ -11,7 +11,12 @@ stdenv.mkDerivation rec {
sha256 = "148361pixrm94q6v04k13s1msa04bx9yc3djb0lxpa7dlw19vhcd";
};
NIX_CFLAGS_COMPILE = "-Wno-error=parentheses";
NIX_CFLAGS_COMPILE = [
"-Wno-error=parentheses"
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
"-Wno-error=nonnull"
];
nativeBuildInputs = [ cmake doxygen ];

View File

@ -47,6 +47,11 @@ stdenv.mkDerivation rec {
wayland
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
];
passthru.updateScript = gitUpdater {
rev-prefix = "v";
};

View File

@ -44,6 +44,11 @@ let
"VERSION=${version}"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
meta = common.meta // {
maintainers = with lib.maintainers;
common.meta.maintainers ++ [ skeidel ];

View File

@ -31,6 +31,11 @@ stdenv.mkDerivation rec {
"-DCMAKE_C_FLAGS=-Wno-error=array-bounds"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=stringop-overflow"
];
nativeBuildInputs = [
pkg-config
cmake

View File

@ -38,6 +38,14 @@ in stdenv.mkDerivation rec {
'';
makeFlags = [ "build-core" ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=address"
"-Wno-error=deprecated-declarations"
"-Wno-error=use-after-free"
];
installPhase = ''
runHook preInstall

View File

@ -30,11 +30,14 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "format" ];
NIX_CFLAGS_COMPILE =
"-Wno-error=deprecated-declarations" +
NIX_CFLAGS_COMPILE = [
"-Wno-error=deprecated-declarations"
# Needed with GCC 12
"-Wno-error=address"
"-Wno-error=use-after-free"
# Avoid GL_GLEXT_VERSION double definition
" -DNO_SDL_GLEXT"
;
];
# To avoid problems finding SDL_types.h.
configureFlags = [ "CFLAGS=-I${lib.getDev SDL}/include/SDL" ];

View File

@ -94,6 +94,11 @@ stdenv.mkDerivation {
"-DDOWNLOAD_TITLE_SEQUENCES=OFF"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
];
postUnpack = ''
cp -r ${objects-src} $sourceRoot/data/object
cp -r ${title-sequences-src} $sourceRoot/data/sequence

View File

@ -85,6 +85,11 @@ stdenv.mkDerivation rec {
systemd
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=mismatched-new-delete"
];
patchPhase = ''
patchShebangs scripts

View File

@ -25,6 +25,7 @@ in stdenv.mkDerivation rec {
autoreconfHook
pkg-config
];
buildInputs = [
dpdk_19_11
libconfig
@ -38,6 +39,12 @@ in stdenv.mkDerivation rec {
libbpf
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
"-Wno-error=uninitialized"
];
# binaries will segfault otherwise
dontStrip = true;

View File

@ -46,6 +46,12 @@ stdenv.mkDerivation rec {
RTE_SDK = dpdk;
GUI = lib.optionalString withGtk "true";
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=address"
"-Wno-error=use-after-free"
];
# requires symbols from this file
NIX_LDFLAGS = "-lrte_net_bond";

View File

@ -60,6 +60,11 @@ let
(lib.optionalString (!useClang) "-DUSE_LD=GOLD")
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=missing-template-keyword"
];
inherit patches;
# fix up the use of the very weird and custom 'fdb_install' command by just

View File

@ -15,6 +15,12 @@ stdenv.mkDerivation rec {
buildInputs = [ bzip2 libxml2 libzip boost lua luabind tbb expat ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=stringop-overflow"
"-Wno-error=uninitialized"
];
postInstall = "mkdir -p $out/share/osrm-backend && cp -r ../profiles $out/share/osrm-backend/profiles";
meta = {

View File

@ -78,6 +78,8 @@ in stdenv.mkDerivation {
NIX_CFLAGS_COMPILE = [
"-Wno-error=format-truncation"
"-Wno-error=stringop-truncation"
# Needed with GCC 12
"-Wno-error=use-after-free"
];
configureFlags = [

View File

@ -878,6 +878,11 @@ self: super:
"--disable-tls"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
postInstall = ''
rm -fr $out/share/X11/xkb/compiled # otherwise X will try to write in it
( # assert() keeps runtime reference xorgserver-dev in xf86-video-intel and others

View File

@ -34,7 +34,6 @@ stdenv.mkDerivation rec {
sha256 = "sha256-77X+AvHFWfYYIio3c+EYf11jg/1IbYhNUweRIDHMOZw=";
};
patches = [
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/TigerVNC/tigervnc/pull/1383.patch";
@ -65,6 +64,10 @@ stdenv.mkDerivation rec {
"-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "out"}/bin"
];
NIX_CFLAGS_COMPILE = [
"-Wno-error=array-bounds"
];
postBuild = lib.optionalString stdenv.isLinux ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -Wno-error=int-to-pointer-cast -Wno-error=pointer-to-int-cast"
export CXXFLAGS="$CXXFLAGS -fpermissive"

View File

@ -53,14 +53,17 @@ stdenv.mkDerivation rec {
"-Dversion=${version}"
];
NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isDarwin [
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=address"
] ++ lib.optionals stdenv.isDarwin [
"-Wno-sometimes-uninitialized"
"-Wno-tautological-pointer-compare"
] ++ lib.optionals stdenv.isLinux [
"-Wno-array-bounds"
"-Wno-free-nonheap-object"
"-Wno-stringop-truncation"
]);
];
passthru = {
updateScript = nix-update-script { };

View File

@ -24,7 +24,11 @@ in stdenv.mkDerivation rec {
pname = "blobfuse";
inherit version src;
NIX_CFLAGS_COMPILE = "-Wno-error=catch-value";
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=deprecated-declarations"
"-Wno-error=catch-value"
];
buildInputs = [ curl gnutls libgcrypt libuuid fuse boost cpplite ];
nativeBuildInputs = [ cmake pkg-config ];

View File

@ -14,6 +14,11 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-std=c++14"
];
installPhase = ''
mkdir -p $out/bin
cp iDSK $out/bin

View File

@ -11,6 +11,11 @@ stdenv.mkDerivation rec {
buildInputs = [ liblockfile ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=format-overflow"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/man/man1

View File

@ -16,6 +16,11 @@ stdenv.mkDerivation rec {
buildInputs = [ libbfd zlib libiberty ];
makeFlags = [ "wimboot.x86_64.efi" ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=array-bounds"
];
installPhase = ''
mkdir -p $out/share/wimboot/
cp wimboot.x86_64.efi $out/share/wimboot

View File

@ -22,6 +22,11 @@ stdenv.mkDerivation rec {
"SD_NOTIFY=1"
];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=maybe-uninitialized"
];
installFlags = [
"sysconfdir=${placeholder "out"}/etc"
];

View File

@ -18,6 +18,11 @@ stdenv.mkDerivation {
nativeBuildInputs = [ cmake perl ];
buildInputs = [ libubox json_c ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=dangling-pointer"
];
meta = with lib; {
description = "Tiny QMI command line utility";
homepage = "https://git.openwrt.org/?p=project/uqmi.git;a=summary";

View File

@ -51,6 +51,11 @@ let
--replace '"clang++"' '"clang++-UNSUPPORTED"'
'';
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=use-after-free"
];
makeFlags = [ "PREFIX=$(out)" ];
buildPhase = ''
common="$makeFlags -j$NIX_BUILD_CORES"

View File

@ -40,6 +40,11 @@ python3.pkgs.buildPythonApplication rec {
mkdir -p $CHIPSEC_BUILD_LIB/chipsec/helper/linux
'';
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=dangling-pointer"
];
preInstall = lib.optionalString withDriver ''
mkdir -p $out/${python3.pkgs.python.sitePackages}/drivers/linux
mv $CHIPSEC_BUILD_LIB/chipsec/helper/linux/chipsec.ko \

View File

@ -29,7 +29,11 @@ stdenv.mkDerivation rec {
"iasl"
];
NIX_CFLAGS_COMPILE = "-O3";
NIX_CFLAGS_COMPILE = [
"-O3"
# Needed with GCC 12
"-Wno-dangling-pointer"
];
enableParallelBuilding = true;

View File

@ -21,6 +21,11 @@ stdenv.mkDerivation rec {
buildInputs = lib.optionals stdenv.isDarwin [ CoreServices CoreFoundation ];
NIX_CFLAGS_COMPILE = [
# Needed with GCC 12
"-Wno-error=mismatched-new-delete"
];
postPatch = lib.optionalString stdenv.isAarch64 ''
substituteInPlace Makefile \
--replace "-msse2" "" --replace "-DUSE_SSE2" ""