Skip to content

{libbladeRF,uhd}: fix darwin-aarch64 builds#457704

Open
fmeef wants to merge 2 commits into
NixOS:masterfrom
fmeef:darwin_bladerf
Open

{libbladeRF,uhd}: fix darwin-aarch64 builds#457704
fmeef wants to merge 2 commits into
NixOS:masterfrom
fmeef:darwin_bladerf

Conversation

@fmeef

@fmeef fmeef commented Nov 2, 2025

Copy link
Copy Markdown
Contributor

Fix build of two specific gnuradio dependencies on aarch64-darwin. libbladeRF and uhd both had issues building specifically on aarch64-darwin.

  • libbladeRF had a compiler warning in its unit tests, this was fixed by adding Wno-error=tautological-overlap-compare to CFLAGS.

  • uhd requires an older clang to build, this was inspired by issues like azurite: 3.35.0 fails to build on aarch64-darwin #449650. Downgraded to clang_20 for now only on aarch64-darwin

  • Built on platform:

    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:

  • [] Ran nixpkgs-review on this PR. See nixpkgs-review usage.

  • Tested basic functionality of all binary files, usually in ./result/bin/.

  • Nixpkgs Release Notes

    • Package update: when the change is major or breaking.
  • NixOS Release Notes

    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

@ofborg ofborg Bot added the 6.topic: darwin Running or building packages on Darwin label Nov 2, 2025
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 12.first-time contribution This PR is the author's first one; please be gentle! labels Nov 2, 2025
Comment thread pkgs/by-name/uh/uhd/package.nix Outdated
@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
];

env = lib.optionalAttrs stdenv.cc.isClang {
NIX_CFLAGS_COMPILE = "-Wno-error=unused-but-set-variable";
NIX_CFLAGS_COMPILE = "-Wno-error=unused-but-set-variable -Wno-error=tautological-overlap-compare";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. I never had direct access to Darwin machines along with the motivation to do so to test this thoroughly, but it'd be great to debug these build failures with upstream. They seem to be pretty active. Also, cc @cyclic-pentane per Nuand/bladeRF#984 (comment) - I assume they have some relevant knowledge :).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not - but I also have an aarch64-darwin machine I'm using Nix on, so I might try to debug this one of these days too.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also waiting here for more clues regarding libbladerf darwin CFLAGS.

@fmeef fmeef force-pushed the darwin_bladerf branch 6 times, most recently from bae3489 to 8c037d8 Compare November 2, 2025 20:19
Comment thread pkgs/by-name/uh/uhd/package.nix Outdated
Comment thread pkgs/by-name/uh/uhd/package.nix Outdated
Comment on lines +43 to +49
(
if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then
llvmPackages_20.stdenv
else
stdenv
).mkDerivation
(finalAttrs: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To minimize the diff, it'd be a bit better to use a buildStdenv variable in the let in above, and use it here. This PR change is still missing a description of the errors you get with the regular stdenv, and is still missing a link to a discussion or an attempt to discuss the failures with upstream.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for uhd the error is

/nix/store/hn2ph6rpxfqkc46xjvlvmiypmznn748f-boost-1.87.0-dev/include/boost/type_traits/is_signed.hpp:37:38: note: integer value -1 is outside the valid range of values [0, 127] for the enumeration type 'stream_mode_t'
   37 |    static const no_cv_t minus_one = (static_cast<no_cv_t>(-1));
      |                                      ^
In file included from /nix/var/nix/builds/nix-50132-1640262001/source/host/lib/usrp/cores/rx_dsp_core_200.cpp:9:
In file included from /nix/var/nix/builds/nix-50132-1640262001/source/host/include/uhd/types/dict.hpp:156:
In file included from /nix/var/nix/builds/nix-50132-1640262001/source/host/include/uhd/types/dict.ipp:13:
In file included from /nix/store/hn2ph6rpxfqkc46xjvlvmiypmznn748f-boost-1.87.0-dev/include/boost/lexical_cast.hpp:33:
In file included from /nix/store/hn2ph6rpxfqkc46xjvlvmiypmznn748f-boost-1.87.0-dev/include/boost/lexical_cast/try_lexical_convert.hpp:31:
In file included from /nix/store/hn2ph6rpxfqkc46xjvlvmiypmznn748f-boost-1.87.0-dev/include/boost/lexical_cast/detail/converter_numeric.hpp:31:
In file included from /nix/store/hn2ph6rpxfqkc46xjvlvmiypmznn748f-boost-1.87.0-dev/include/boost/type_traits/make_unsigned.hpp:15:
/nix/store/hn2ph6rpxfqkc46xjvlvmiypmznn748f-boost-1.87.0-dev/include/boost/type_traits/is_unsigned.hpp:38:25: error: in-class initializer for static data member is not a constant expression
   38 |    static const no_cv_t minus_one = (static_cast<no_cv_t>(-1));
      |                         ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~

and for libbladeRF the error is


[ 79%] Building C object host/utilities/bladeRF-fsk/c/CMakeFiles/bladeRF-fsk_test_suite.dir/src/crc32.c.o
/nix/var/nix/builds/nix-31591-1882500057/source/host/utilities/bladeRF-cli/src/cmd/flash_image.c:71:35: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare]
   71 |                 if (val[i] >= 'a' || val[i] <= 'f') {
      |                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
1 error generated.

@fmeef fmeef force-pushed the darwin_bladerf branch 5 times, most recently from 89dd1e9 to f7262a9 Compare November 4, 2025 05:23

@doronbehar doronbehar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR's commits should be:

libbladerf: fix build on Darwin
uhd: fix unit tests on aarch64-darwin

And note the unresolved review comments.

Comment thread pkgs/by-name/uh/uhd/package.nix Outdated
@@ -32,13 +32,21 @@
enableN320 ? true,
enableE300 ? true,
enableE320 ? true,
llvmPackages_20,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move this argument upwards near stdenv? There is a sort of category division of the various arguments and this breaks this division.

Comment thread pkgs/by-name/uh/uhd/package.nix Outdated
Comment on lines +40 to +49
mkDerivation =
(
if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then
llvmPackages_20.stdenv
else
stdenv
).mkDerivation;
in

stdenv.mkDerivation (finalAttrs: {
mkDerivation (finalAttrs: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principal, when modifying stdenv like this, one should use a variable named stdenv', and then also modify all stdenv usages below to be stdenv', as the boolean flags evaluated below in principal can change due to such a conditional.

Comment thread pkgs/by-name/uh/uhd/package.nix Outdated
}:

let
inherit (lib) optionals cmakeBool;
mkDerivation =
(
if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is still missing an attempt to discuss the failures with upstream.

@fmeef fmeef Nov 4, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue here EttusResearch/uhd#881

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue here EttusResearch/uhd#881

Thanks, let's give them a few days to reply. I subscribed to the issue.

@@ -181,7 +188,7 @@ stdenv.mkDerivation (finalAttrs: {
];

# many tests fails on darwin, according to ofborg

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Speaking of Darwin, have you tried to enable the tests?

@doronbehar doronbehar changed the title Fix build of libbladeRF and uhd on darwin-aarch64 {libbladeRF,uhd}: fix darwin-aarch64 builds Nov 4, 2025

@doronbehar doronbehar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fmeef I just realized I had a stale review here (written below). The UHD darwin build failure issue is pretty active and I just wrote there a message regarding the workaround applied here. I also forgot about this PR while working on #481933 . Since I'm still a bit hesitant as for the libbladeRF change, I copied the UHD changes here into #481933 while giving you credit.

@@ -62,7 +62,7 @@ stdenv.mkDerivation rec {
];

env = lib.optionalAttrs stdenv.cc.isClang {
NIX_CFLAGS_COMPILE = "-Wno-error=unused-but-set-variable";
NIX_CFLAGS_COMPILE = "-Wno-error=unused-but-set-variable -Wno-error=tautological-overlap-compare";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also waiting here for more clues regarding libbladerf darwin CFLAGS.

@nixpkgs-ci nixpkgs-ci Bot added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 12.first-time contribution This PR is the author's first one; please be gentle! labels Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants