fatal error: json-c/json.h: No such file or directory

1,819 views
Skip to first unread message

Jörg Krause

unread,
Jan 21, 2018, 2:53:07 PM1/21/18
to swupdate
When building SWUpdate with the following defconfig

# CONFIG_LUA is not set
CONFIG_DOWNLOAD
=y
CONFIG_UBIVOL
=y
CONFIG_CFI
=y
CONFIG_RAW
=y
CONFIG_SHELLSCRIPTHANDLER
=y

.. the build process breaks with:

corelib/channel_curl.c:27:10: fatal error: json-c/json.h: No such file or directory
 
#include <json-c/json.h>

A quick look shows that CONFIG_DOWNLOAD depends on HAVE_LIBCURL which selects CURL which in return enables the build of channel_curl.o. I am not sure when channel_curl is required, but I guess it is only needed for Suricatta support, right?

Maybe we need something like CONFIG_SURICATTA_SERVER_SUPPORT (not tested!):



config SURICATTA_SERVER_SUPPORT
   
bool "Suricatta Server support"
    depends on HAVE_LIBCURL
    depends on HAVE_JSON_C
   
select JSON
   
select CURL
    help
     
Surricata Server support.

config SURICATTA_SERVER_HAWKBIT
   
bool "Suricatta hawkBit server support"
   
select SURICATTA_SERVER_SUPPORT
    help
     
Support for hawkBit server.


config SURICATTA_SERVER_OTHER
   
bool "Suricatta other server support"
   
select SURICATTA_SERVER_SUPPORT
    help
     
Support for other server.

So channel_curl.o can be enabled by:

lib-$(CONFIG_SURICATTA_SERVER_SUPPORT) += channel_curl.o

Best regards,
Jörg Krause

Stefano Babic

unread,
Jan 21, 2018, 4:18:02 PM1/21/18
to Jörg Krause, swupdate
Hi Jörg,

On 21/01/2018 20:53, Jörg Krause wrote:
> When building SWUpdate with the following defconfig
>
> |
> # CONFIG_LUA is not set
> CONFIG_DOWNLOAD=y
> CONFIG_UBIVOL=y
> CONFIG_CFI=y
> CONFIG_RAW=y
> CONFIG_SHELLSCRIPTHANDLER=y
> |
>
> .. the build process breaks with:
>
> |
> corelib/channel_curl.c:27:10:fatal error:json-c/json.h:Nosuch file
> ordirectory
>  #include<json-c/json.h>
> |
>
> A quick look shows that CONFIG_DOWNLOAD depends on HAVE_LIBCURLwhich
> selects CURLwhich in return enables the build of channel_curl.o. I am
> not sure when channel_curl is required, but I guess it is only needed
> for Suricatta support, right?

Not anymore - functions was extracted from suricatta code and moved to
channel_curl to make them available to other modules, not only to suricatta.

The first use case I have is with the swuforward handler.

But you're right, channel_curl depends on CURL *and* JSON.

>
> Maybe we need something like CONFIG_SURICATTA_SERVER_SUPPORT(not tested!):
>
> |
>
>
> config SURICATTA_SERVER_SUPPORT
>     bool"Suricatta Server support"
>     depends on HAVE_LIBCURL
>     depends on HAVE_JSON_C
>     selectJSON
>     selectCURL
>     help
>       SurricataServersupport.
>
> config SURICATTA_SERVER_HAWKBIT
>     bool"Suricatta hawkBit server support"
>     selectSURICATTA_SERVER_SUPPORT
>     help
>       SupportforhawkBit server.
>
>
> config SURICATTA_SERVER_OTHER
>     bool"Suricatta other server support"
>     selectSURICATTA_SERVER_SUPPORT
>     help
>       Supportforother server.
> |
>
> So channel_curl.o can be enabled by:
>
> |
> lib-$(CONFIG_SURICATTA_SERVER_SUPPORT)+=channel_curl.o

No, this breaks the swuforward handler.

What about this one (untested, too):

diff --git a/corelib/Makefile b/corelib/Makefile
index 282bffd..20b3ad0 100644
--- a/corelib/Makefile
+++ b/corelib/Makefile
@@ -17,4 +17,7 @@ lib-$(CONFIG_ENCRYPTED_IMAGES) +=
swupdate_decrypt.o
lib-$(CONFIG_LIBCONFIG) += swupdate_settings.o \
parsing_library_libconfig.o
lib-$(CONFIG_JSON) += parsing_library_libjson.o
-lib-$(CONFIG_CURL) += channel_curl.o
+ifeq ($(CONFIG_CURL)$(CONFIG_JSON),yy)
+lib-y += channel_curl.o
+endif

Best regards,
Stefano Babic

--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Jörg Krause

unread,
Jan 21, 2018, 4:44:27 PM1/21/18
to swupdate
Hi Stefano,
This should fix the build at least. But in my opinion a feature option would be better than enabling it because I use the downloader and a json parser (having libcurl and json-c enabled). How about suricatta and the swuforward handler selecting the hidden config option CHANNEL_CURL so we can use 

lib-$(CONFIG_CHANNEL_CURL)+=channel_curl.o

Jörg

Stefano Babic

unread,
Jan 21, 2018, 4:49:05 PM1/21/18
to Jörg Krause, swupdate
Hi Jörg,
Agree, this is a cleaner solution.

> How about suricatta and the
> swuforward handler selecting the hidden config option CHANNEL_CURL so we
> can use 
>
> |
> lib-$(CONFIG_CHANNEL_CURL)+=channel_curl.o

+1

Best regards,
Stefano

Andreas Ufert

unread,
Jan 20, 2022, 8:32:31 AM1/20/22
to swupdate
Hi,

sorry for following up on such an old conversation but my problem might be linked to this topic.

My environment:

- yocto
- poky (gatesgarth)
- meta-swupdate (gatesgarth)

My Image recipe includes swupdate and the build process tries to compile version 2021.04 of it.

Starting of from the default config I only switched the bootloader to grub and enabled Suricatta. The config fragment (made by menuconfig/diffconfig) is:

# CONFIG_UBOOT is not set
CONFIG_BOOTLOADER_GRUB=y
CONFIG_CURL=y
CONFIG_CHANNEL_CURL=y
CONFIG_SURICATTA=y

# CONFIG_SURICATTA_SSL is not set

CONFIG_SURICATTA_HAWKBIT=y
# CONFIG_SURICATTA_GENERAL is not set
CONFIG_JSON=y


Given this setup I end up with a compilation error: "fatal error: json-c/json.h: No such file or directory"
How can I fix that so I end up with suricatta support?

Thanks in advance!

Regards, Andreas

PS: I'll post the full compile log here, if needed
Reply all
Reply to author
Forward
0 new messages