Skip to contentSkip to conversation

tools: require at least json-c 0.15

PATCH In review Anthony PERARD 5 participants 8 messages Oct 23, 2025 – Oct 24, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools: require at least json-c 0.15

From: Anthony PERARD <[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

---
 tools/configure    | 16 ++++++++--------
 tools/configure.ac |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)
tools/configure +8 -8
index 0eb7a0ab6a..d460f25529 100755
@@ -9642,12 +9642,12 @@ if test -n "$libjsonc_CFLAGS"; then
     pkg_cv_libjsonc_CFLAGS="$libjsonc_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c >= 0.15\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c >= 0.15") 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_libjsonc_CFLAGS=`$PKG_CONFIG --cflags "json-c" 2>/dev/null`
+  pkg_cv_libjsonc_CFLAGS=`$PKG_CONFIG --cflags "json-c >= 0.15" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -9659,12 +9659,12 @@ if test -n "$libjsonc_LIBS"; then
     pkg_cv_libjsonc_LIBS="$libjsonc_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c >= 0.15\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c >= 0.15") 2>&5
   ac_status=$?
   printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_libjsonc_LIBS=`$PKG_CONFIG --libs "json-c" 2>/dev/null`
+  pkg_cv_libjsonc_LIBS=`$PKG_CONFIG --libs "json-c >= 0.15" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -9685,9 +9685,9 @@ else
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c" 2>&1`
+	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c >= 0.15" 2>&1`
         else
-	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c" 2>&1`
+	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c >= 0.15" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
 	echo "$libjsonc_PKG_ERRORS" >&5
tools/configure.ac +1 -1
index 7267d02a04..285b4ea128 100644
@@ -424,7 +424,7 @@ AC_SUBST([ZLIB_CFLAGS])
 AC_SUBST([ZLIB_LIBS])
 AX_CHECK_EXTFS
 AX_CHECK_PTHREAD
-PKG_CHECK_MODULES([libjsonc], [json-c],
+PKG_CHECK_MODULES([libjsonc], [json-c >= 0.15],
     [AC_DEFINE([HAVE_LIBJSONC], [1], [Use library json-c])],
     [AC_CHECK_LIB([yajl], [yajl_alloc],
         [AC_SUBST([YAJL_LIBS],[-lyajl])
Signature · 1 line
Anthony PERARD
#1 lore raw
Quoted 10 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

Thanks for sorting this. I can't really offer R-b on this, and A-b would (at least formally) be meaningless. If you nevertheless want to apply the A-b, feel free to do so.

Jan

#2 lore raw
In reply to Anthony PERARD
Quoted 10 lines · Anthony PERARD

From: Anthony PERARD<[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

Thanks.

~ Oleksii

Quoted 66 lines
---
  tools/configure    | 16 ++++++++--------
  tools/configure.ac |  2 +-
  2 files changed, 9 insertions(+), 9 deletions(-)
tools/configure +8 -8
index 0eb7a0ab6a..d460f25529 100755
@@ -9642,12 +9642,12 @@ if test -n "$libjsonc_CFLAGS"; then
      pkg_cv_libjsonc_CFLAGS="$libjsonc_CFLAGS"
   elif test -n "$PKG_CONFIG"; then
      if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c >= 0.15\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c >= 0.15") 2>&5
    ac_status=$?
    printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    test $ac_status = 0; }; then
-  pkg_cv_libjsonc_CFLAGS=`$PKG_CONFIG --cflags "json-c" 2>/dev/null`
+  pkg_cv_libjsonc_CFLAGS=`$PKG_CONFIG --cflags "json-c >= 0.15" 2>/dev/null`
  		      test "x$?" != "x0" && pkg_failed=yes
  else
    pkg_failed=yes
@@ -9659,12 +9659,12 @@ if test -n "$libjsonc_LIBS"; then
      pkg_cv_libjsonc_LIBS="$libjsonc_LIBS"
   elif test -n "$PKG_CONFIG"; then
      if test -n "$PKG_CONFIG" && \
-    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "json-c") 2>&5
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c >= 0.15\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "json-c >= 0.15") 2>&5
    ac_status=$?
    printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
    test $ac_status = 0; }; then
-  pkg_cv_libjsonc_LIBS=`$PKG_CONFIG --libs "json-c" 2>/dev/null`
+  pkg_cv_libjsonc_LIBS=`$PKG_CONFIG --libs "json-c >= 0.15" 2>/dev/null`
  		      test "x$?" != "x0" && pkg_failed=yes
  else
    pkg_failed=yes
@@ -9685,9 +9685,9 @@ else
          _pkg_short_errors_supported=no
  fi
          if test $_pkg_short_errors_supported = yes; then
-	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c" 2>&1`
+	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c >= 0.15" 2>&1`
          else
-	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c" 2>&1`
+	        libjsonc_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c >= 0.15" 2>&1`
          fi
  	# Put the nasty error message in config.log where it belongs
  	echo "$libjsonc_PKG_ERRORS" >&5
tools/configure.ac +1 -1
index 7267d02a04..285b4ea128 100644
@@ -424,7 +424,7 @@ AC_SUBST([ZLIB_CFLAGS])
  AC_SUBST([ZLIB_LIBS])
  AX_CHECK_EXTFS
  AX_CHECK_PTHREAD
-PKG_CHECK_MODULES([libjsonc], [json-c],
+PKG_CHECK_MODULES([libjsonc], [json-c >= 0.15],
      [AC_DEFINE([HAVE_LIBJSONC], [1], [Use library json-c])],
      [AC_CHECK_LIB([yajl], [yajl_alloc],
          [AC_SUBST([YAJL_LIBS],[-lyajl])
Acked-by on v1 1/1
#3 lore raw
In reply to Anthony PERARD
Quoted 10 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

However, you should adjust README and possibly Changelog.md to give this new minimum version.

#4 lore raw
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

Quoted 6 lines
Quoted 1 line

However, you should adjust README and possibly Changelog.md to give this new minimum version.

Will this do?

CHANGELOG.md +2 -2
index 0cf9ad2d95..fc4f6d7c8a 100644
@@ -14,8 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Debian Trixie added to CI.  Debian Bullseye retired from CI for RISC-V due
    to the baseline change.
  - Linux based device model stubdomains are now fully supported.
- - New dependency on library json-c, the toolstack will prefer it to `YAJL`
-   when available.
+ - New dependency on library json-c 0.15 or later, the toolstack will prefer it
+   to `YAJL` when available.
 
  - On x86:
    - Restrict the cache flushing done as a result of guest physical memory map
README +2 -1
index eaee78bd73..53a4d5c2ae 100644
@@ -53,7 +53,8 @@ provided by your OS distributor:
     * Development install of Python 2.7 or later (e.g., python-dev)
     * Development install of curses (e.g., libncurses-dev)
     * Development install of uuid (e.g. uuid-dev)
-    * Development install of json-c (e.g. libjson-c-dev) or yajl (e.g. libyajl-dev)
+    * Development install of json-c 0.15 or later (e.g. libjson-c-dev)
+      or yajl (e.g. libyajl-dev)
     * Development install of libaio (e.g. libaio-dev) version 0.3.107 or
       greater.
     * Development install of GLib v2.0 (e.g. libglib2.0-dev)

Cheers,

Signature · 1 line
Anthony PERARD
#5 lore raw
Quoted 39 lines · Anthony PERARD
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

Quoted 5 lines
Quoted 1 line

However, you should adjust README and possibly Changelog.md to give this new minimum version.

Will this do?

CHANGELOG.md +2 -2
index 0cf9ad2d95..fc4f6d7c8a 100644
@@ -14,8 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
  - Debian Trixie added to CI.  Debian Bullseye retired from CI for RISC-V due
    to the baseline change.
  - Linux based device model stubdomains are now fully supported.
- - New dependency on library json-c, the toolstack will prefer it to `YAJL`
-   when available.
+ - New dependency on library json-c 0.15 or later, the toolstack will prefer it
+   to `YAJL` when available.
 
  - On x86:
    - Restrict the cache flushing done as a result of guest physical memory map
README +0 -0
index eaee78bd73..53a4d5c2ae 100644

README provided by your OS distributor: · line 60

Quoted 9 lines
README +2 -1
@@ -53,7 +53,8 @@ provided by your OS distributor:
     * Development install of Python 2.7 or later (e.g., python-dev)
     * Development install of curses (e.g., libncurses-dev)
     * Development install of uuid (e.g. uuid-dev)
-    * Development install of json-c (e.g. libjson-c-dev) or yajl (e.g. libyajl-dev)
+    * Development install of json-c 0.15 or later (e.g. libjson-c-dev)
+      or yajl (e.g. libyajl-dev)
     * Development install of libaio (e.g. libaio-dev) version 0.3.107 or
       greater.
     * Development install of GLib v2.0 (e.g. libglib2.0-dev)

Yup.  LGTM.

~Andrew

#6 lore raw
In reply to Anthony PERARD
Quoted 49 lines · Anthony PERARD
Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Anthony PERARD

From: Anthony PERARD<[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.

Quoted 5 lines
Quoted 1 line

However, you should adjust README and possibly Changelog.md to give this new minimum version.

Will this do?

CHANGELOG.md +2 -2
index 0cf9ad2d95..fc4f6d7c8a 100644
@@ -14,8 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
   - Debian Trixie added to CI.  Debian Bullseye retired from CI for RISC-V due
     to the baseline change.
   - Linux based device model stubdomains are now fully supported.
- - New dependency on library json-c, the toolstack will prefer it to `YAJL`
-   when available.
+ - New dependency on library json-c 0.15 or later, the toolstack will prefer it
+   to `YAJL` when available.
 
   - On x86:
     - Restrict the cache flushing done as a result of guest physical memory map
README +2 -1
index eaee78bd73..53a4d5c2ae 100644
@@ -53,7 +53,8 @@ provided by your OS distributor:
      * Development install of Python 2.7 or later (e.g., python-dev)
      * Development install of curses (e.g., libncurses-dev)
      * Development install of uuid (e.g. uuid-dev)
-    * Development install of json-c (e.g. libjson-c-dev) or yajl (e.g. libyajl-dev)
+    * Development install of json-c 0.15 or later (e.g. libjson-c-dev)
+      or yajl (e.g. libyajl-dev)
      * Development install of libaio (e.g. libaio-dev) version 0.3.107 or
        greater.
      * Development install of GLib v2.0 (e.g. libglib2.0-dev)
Quoted 1 line

Cheers,

LGTM. Free to add my:

~ Oleksii

Quoted 1 line
Reviewed-by on v1 1/1
#7 lore raw
In reply to Anthony PERARD
Quoted 10 lines · Anthony PERARD

From: Anthony PERARD <[email protected]>

If not available, fallback to using YAJL.

The code is using json_c_visit() which was introduced in 0.13. json_object_new_null() and json_object_new_uint64() where added to 0.14. And the last one json_object_new_array_ext() was introduced in 0.15.