From 791b8bb22838cbad22100ed2778c711efa8a18b1 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Sun, 21 Sep 2025 02:42:44 +0300 Subject: [PATCH] cogl: fix build with gcc15 - add "-std=gnu17" to `env.NIX_CFLAGS_COMPILE` Upstream repo is archived: https://gitlab.gnome.org/Archive/cogl Other distros also used "-std=gnu17": https://gitlab.alpinelinux.org/alpine/aports/-/commit/d9e057053f20fcc7d46c7f8c6222100a88e017e8 https://github.com/gentoo/gentoo/commit/379ca097b966b40890b5a4572502b8f9352a374d https://src.fedoraproject.org/rpms/cogl/c/442af4e8c3e17e8d5b051a4e1600f23f366f5554 Fixes build failure with gcc15: ``` cogl-path.c:1361:20: error: passing argument 3 of 'gluTessCallback' from incompatible pointer type [8;;https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Warning-Options.html#index-Wincompatible-pointer-types-Wincompatible-pointer-types8;;] 1361 | _cogl_path_tesselator_begin); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | void (*)(GLenum, CoglPathTesselator *) {aka void (*)(unsigned int, struct _CoglPathTesselator *)} In file included from cogl-path.c:49: tesselator/tesselator.h:57:70: note: expected 'void (*)(void)' but argument is of type 'void (*)(GLenum, CoglPathTesselator *)' {aka 'void (*)(unsigned int, struct _CoglPathTesselator *)'} 57 | void gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); | ~~~~~~~~~~~~^~~~~~~~~~~~ cogl-path.c:1094:1: note: '_cogl_path_tesselator_begin' declared here 1094 | _cogl_path_tesselator_begin (GLenum type, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` --- pkgs/by-name/co/cogl/package.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/co/cogl/package.nix b/pkgs/by-name/co/cogl/package.nix index 242208008431..e3d1975ac146 100644 --- a/pkgs/by-name/co/cogl/package.nix +++ b/pkgs/by-name/co/cogl/package.nix @@ -111,9 +111,16 @@ stdenv.mkDerivation rec { "-I${harfbuzz.dev}/include/harfbuzz" ] ); - } - // lib.optionalAttrs stdenv.cc.isClang { - NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration"; + NIX_CFLAGS_COMPILE = toString ( + [ ] + ++ lib.optional stdenv.cc.isGNU [ + # Fix build with gcc15 + "-std=gnu17" + ] + ++ lib.optional stdenv.cc.isClang [ + "-Wno-error=implicit-function-declaration" + ] + ); }; #doCheck = true; # all tests fail (no idea why)