Skip to content

Commit

Permalink
Merge pull request #240640 from reckenrode/jq-clang16
Browse files Browse the repository at this point in the history
jq: fix build with clang 16 on Darwin
  • Loading branch information
7c6f434c authored Jun 30, 2023
2 parents 36acc4f + 4f67734 commit 717fa71
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkgs/development/tools/jq/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, stdenv
, fetchurl
, autoreconfHook
, bison
, onigurumaSupport ? true
, oniguruma
}:
Expand Down Expand Up @@ -38,7 +39,16 @@ stdenv.mkDerivation rec {
'';

buildInputs = lib.optionals onigurumaSupport [ oniguruma ];
nativeBuildInputs = [ autoreconfHook ];
nativeBuildInputs = [ autoreconfHook bison ];

# Darwin requires _REENTRANT be defined to use functions like `lgamma_r`.
# Otherwise, configure will detect that they’re in libm, but the build will fail
# with clang 16+ due to calls to undeclared functions.
# This is fixed upstream and can be removed once jq is updated (to 1.7 or an unstable release).
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin (toString [
"-D_REENTRANT=1"
"-D_DARWIN_C_SOURCE=1"
]);

configureFlags = [
"--bindir=\${bin}/bin"
Expand Down

0 comments on commit 717fa71

Please sign in to comment.