From bdaeae3fbacde765d0187d697364f5b7ebbb04ac Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 10 Feb 2024 20:39:46 +0000 Subject: [PATCH] p4c: fix `gcc-13` build failure Without the change build fails on `master` as https://hydra.nixos.org/build/247605854: In file included from /build/source/lib/hex.cpp:17: /build/source/lib/hex.h:25:5: error: 'intmax_t' does not name a type; did you mean 'int8_t'? 25 | intmax_t val; | ^~~~~~~~ | int8_t --- pkgs/development/compilers/p4c/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkgs/development/compilers/p4c/default.nix b/pkgs/development/compilers/p4c/default.nix index 99ec78c6ecee..54d2875d1bc3 100644 --- a/pkgs/development/compilers/p4c/default.nix +++ b/pkgs/development/compilers/p4c/default.nix @@ -1,6 +1,7 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , cmake , boehmgc , bison @@ -37,6 +38,16 @@ stdenv.mkDerivation (finalAttrs: { fetchSubmodules = true; }; + patches = [ + # Fix gcc-13 build: + # https://github.com/p4lang/p4c/pull/4084 + (fetchpatch { + name = "gcc-13.patch"; + url = "https://github.com/p4lang/p4c/commit/6756816100b7c51e3bf717ec55114a8e8575ba1d.patch"; + hash = "sha256-wWM1qjgQCNMPdrhQF38jzFgODUsAcaHTajdbV7L3y8o="; + }) + ]; + postFetch = '' rm -rf backends/ebpf/runtime/contrib/libbpf rm -rf control-plane/p4runtime