The build of xen-4.21.0 with json-c present and yajl not present
is failing with the error

libxl_nocpuid.c:43:1: error: unknown type name ‘yajl_gen_status’
   43 | yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
      | ^~~~~~~~~~~~~~~
libxl_nocpuid.c:43:50: error: unknown type name ‘yajl_gen’
   43 | yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
      |                                                  ^~~~~~~~
make[6]: *** [/builddir/build/BUILD/xen-4.21.0-build/xen-4.21.0/tools/libs/light/../../../tools/Rules.mk:178: libxl_nocpuid.o] Error 1

I tested it with the patch below based on libxl_nocpuid.c which did build.

Signed-off-by: Michael Young <[email protected]>
---
 tools/libs/light/libxl_nocpuid.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/libs/light/libxl_nocpuid.c b/tools/libs/light/libxl_nocpuid.c
index 0630959e76..71ab49ed61 100644
--- a/tools/libs/light/libxl_nocpuid.c
+++ b/tools/libs/light/libxl_nocpuid.c
@@ -40,11 +40,24 @@ int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
     return 0;
 }

+#ifdef HAVE_LIBJSONC
+#ifndef _hidden
+#define _hidden
+#endif
+_hidden int libxl_cpuid_policy_list_gen_jso(json_object **jso_r,
+                                libxl_cpuid_policy_list *pcpuid)
+{
+    return 0;
+}
+#endif
+
+#if defined(HAVE_LIBYAJL)
 yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
                                 libxl_cpuid_policy_list *pcpuid)
 {
     return 0;
 }
+#endif

 int libxl__cpuid_policy_list_parse_json(libxl__gc *gc,
                                         const libxl__json_object *o,
--
2.51.1

Reply via email to