From f198a8a111ef08079f76171c5b8efdda50518283 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 16 Aug 2025 22:00:26 +0300 Subject: [PATCH] gnuradio: fix cross compilation --- pkgs/applications/radio/gnuradio/default.nix | 4 +++- pkgs/applications/radio/gnuradio/shared.nix | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/radio/gnuradio/default.nix b/pkgs/applications/radio/gnuradio/default.nix index f376fe9e5061..96962f914f7a 100644 --- a/pkgs/applications/radio/gnuradio/default.nix +++ b/pkgs/applications/radio/gnuradio/default.nix @@ -67,7 +67,7 @@ let # when gr-qtgui is disabled, icu needs to be included, otherwise # building with boost 1.7x fails ++ lib.optionals (!(hasFeature "gr-qtgui")) [ icu ]; - pythonNative = with python.pkgs; [ + pythonNative = with python.pythonOnBuildForHost.pkgs; [ mako six ]; @@ -337,6 +337,8 @@ stdenv.mkDerivation ( # This is the only python reference worth removing, if needed. + lib.optionalString (!hasFeature "python-support") '' remove-references-to -t ${python} $out/lib/cmake/gnuradio/GnuradioConfig.cmake + '' + + lib.optionalString (!hasFeature "python-support" && hasFeature "gnuradio-runtime") '' remove-references-to -t ${python} $(readlink -f $out/lib/libgnuradio-runtime${stdenv.hostPlatform.extensions.sharedLibrary}) remove-references-to -t ${python.pkgs.pybind11} $out/lib/cmake/gnuradio/gnuradio-runtimeTargets.cmake ''; diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix index 74864a98cf1b..c604f0bb7360 100644 --- a/pkgs/applications/radio/gnuradio/shared.nix +++ b/pkgs/applications/radio/gnuradio/shared.nix @@ -24,6 +24,7 @@ let minor = builtins.elemAt (lib.splitVersion version) 2; patch = builtins.elemAt (lib.splitVersion version) 3; }; + cross = stdenv.hostPlatform != stdenv.buildPlatform; in { src = @@ -57,7 +58,12 @@ in )) ) featuresInfo ); - cmakeFlags = lib.mapAttrsToList ( + cmakeFlags = [ + # https://pybind11.readthedocs.io/en/stable/changelog.html#version-2-13-0-june-25-2024 + (lib.cmakeBool "CMAKE_CROSSCOMPILING" cross) + (lib.cmakeBool "PYBIND11_USE_CROSSCOMPILING" (cross && hasFeature "gnuradio-runtime")) + ] + ++ lib.mapAttrsToList ( feat: info: ( if feat == "basic" then