Skip to content

Commit

Permalink
jq: fix build with clang 16 on Darwin
Browse files Browse the repository at this point in the history
The configure script for jq 1.6 does not define certain symbols required
on Darwin to make `drem`, `significand`, and `lgamma_r` available. This
works fine on clang 11 but fails with clang 16.

This is fixed upstream. It can be removed once #217345 is merged or jq
is released and updated to 1.7.
  • Loading branch information
reckenrode committed Jun 30, 2023
1 parent 7cb8db1 commit 4f67734
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 4f67734

Please sign in to comment.