about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarkus Theil <theil.markus@gmail.com>2023-08-10 11:26:19 +0200
committerMarkus Theil <theil.markus@gmail.com>2023-08-10 11:26:19 +0200
commite80f51a51493c00fe41bcbf35d251fcb555980d4 (patch)
treea5e15c18eb2977f07832bcb7db28136248d876a6
parent833dd20ab2d7c366c2682e5679a573014e22531c (diff)
frr: disable and warn on cross-compilation with net-snmp
Signed-off-by: Markus Theil <theil.markus@gmail.com>
-rw-r--r--pkgs/servers/frr/clippy-helper.nix10
-rw-r--r--pkgs/servers/frr/default.nix16
2 files changed, 17 insertions, 9 deletions
diff --git a/pkgs/servers/frr/clippy-helper.nix b/pkgs/servers/frr/clippy-helper.nix
index 9e554d4e17e6f..bb5887bda0f3a 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 fae9db04cf0aa..87fd2064a5630 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"