From e80f51a51493c00fe41bcbf35d251fcb555980d4 Mon Sep 17 00:00:00 2001 From: Markus Theil Date: Thu, 10 Aug 2023 11:26:19 +0200 Subject: [PATCH] frr: disable and warn on cross-compilation with net-snmp Signed-off-by: Markus Theil --- pkgs/servers/frr/clippy-helper.nix | 10 +++++----- pkgs/servers/frr/default.nix | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pkgs/servers/frr/clippy-helper.nix b/pkgs/servers/frr/clippy-helper.nix index 9e554d4e17e6..bb5887bda0f3 100644 --- a/pkgs/servers/frr/clippy-helper.nix +++ b/pkgs/servers/frr/clippy-helper.nix @@ -1,9 +1,9 @@ { lib , stdenv -, frr_source -, frr_version +, frrSource +, frrVersion -# build time + # build time , autoreconfHook , flex , bison @@ -16,9 +16,9 @@ stdenv.mkDerivation rec { pname = "frr-clippy-helper"; - version = frr_version; + version = frrVersion; - src = frr_source; + src = frrSource; nativeBuildInputs = [ autoreconfHook diff --git a/pkgs/servers/frr/default.nix b/pkgs/servers/frr/default.nix index fae9db04cf0a..87fd2064a563 100644 --- a/pkgs/servers/frr/default.nix +++ b/pkgs/servers/frr/default.nix @@ -30,8 +30,15 @@ , nettools , nixosTests -# general options -, snmpSupport ? true +# FRR's configure.ac gets SNMP options by executing net-snmp-config on the build host +# This leads to compilation errors when cross compiling. +# E.g. net-snmp-config for x86_64 does not return the ARM64 paths. +# +# SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`" +# SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`" +, snmpSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform + +# other general options besides snmp support , rpkiSupport ? true , numMultipath ? 64 , watchfrrSupport ? true @@ -71,7 +78,8 @@ , ospfApi ? true }: -assert snmpSupport -> stdenv.buildPlatform.canExecute stdenv.hostPlatform; +lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform)) + "cannot enable SNMP support due to cross-compilation issues with net-snmp-config" stdenv.mkDerivation rec { pname = "frr"; @@ -119,7 +127,7 @@ stdenv.mkDerivation rec { # cross-compiling: clippy is compiled with the build host toolchain, split it out to ease # navigation in dependency hell - clippy-helper = buildPackages.callPackage ./clippy-helper.nix { frr_version = version; frr_source=src; }; + clippy-helper = buildPackages.callPackage ./clippy-helper.nix { frrVersion = version; frrSource = src; }; configureFlags = [ "--disable-silent-rules"