{libbladeRF,uhd}: fix darwin-aarch64 builds#457704
Conversation
| @@ -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"; | |||
There was a problem hiding this comment.
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 :).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I'm also waiting here for more clues regarding libbladerf darwin CFLAGS.
bae3489 to
8c037d8
Compare
| ( | ||
| if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then | ||
| llvmPackages_20.stdenv | ||
| else | ||
| stdenv | ||
| ).mkDerivation | ||
| (finalAttrs: { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
89dd1e9 to
f7262a9
Compare
doronbehar
left a comment
There was a problem hiding this comment.
The PR's commits should be:
libbladerf: fix build on Darwin
uhd: fix unit tests on aarch64-darwin
And note the unresolved review comments.
| @@ -32,13 +32,21 @@ | |||
| enableN320 ? true, | |||
| enableE300 ? true, | |||
| enableE320 ? true, | |||
| llvmPackages_20, | |||
There was a problem hiding this comment.
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.
| mkDerivation = | ||
| ( | ||
| if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then | ||
| llvmPackages_20.stdenv | ||
| else | ||
| stdenv | ||
| ).mkDerivation; | ||
| in | ||
|
|
||
| stdenv.mkDerivation (finalAttrs: { | ||
| mkDerivation (finalAttrs: { |
There was a problem hiding this comment.
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.
| }: | ||
|
|
||
| let | ||
| inherit (lib) optionals cmakeBool; | ||
| mkDerivation = | ||
| ( | ||
| if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then |
There was a problem hiding this comment.
This PR is still missing an attempt to discuss the failures with upstream.
There was a problem hiding this comment.
I opened an issue here EttusResearch/uhd#881
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
Speaking of Darwin, have you tried to enable the tests?
doronbehar
left a comment
There was a problem hiding this comment.
@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"; | |||
There was a problem hiding this comment.
I'm also waiting here for more clues regarding libbladerf darwin CFLAGS.
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-compareto 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:
Tested, as applicable:
passthru.tests.[] Ran
nixpkgs-reviewon this PR. See nixpkgs-review usage.Tested basic functionality of all binary files, usually in
./result/bin/.Nixpkgs Release Notes
NixOS Release Notes
Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.