diff mbox series

libubox: remove support for jsoncpp

Message ID 20201225011158.35592-1-rosenp@gmail.com
State New
Headers show
Series libubox: remove support for jsoncpp | expand

Commit Message

Rosen Penev Dec. 25, 2020, 1:11 a.m. UTC
jsoncpp requires a C++ compiler instead of a C one. Fixes the following
build error:

fatal error: cstddef: No such file or directory
 '#include <cstddef>

Issue was discovered on the buildbots where an SDK contained a broken
pkgconf. Make json-c required in order to not even attempt compilation
when json-c is missing.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 CMakeLists.txt | 7 ++-----
 blobmsg_json.c | 6 +-----
 jshn.c         | 6 +-----
 3 files changed, 4 insertions(+), 15 deletions(-)

Comments

Rosen Penev Oct. 20, 2021, 10:51 p.m. UTC | #1
ping

On Thu, Dec 24, 2020 at 5:12 PM Rosen Penev <rosenp@gmail.com> wrote:
>
> jsoncpp requires a C++ compiler instead of a C one. Fixes the following
> build error:
>
> fatal error: cstddef: No such file or directory
>  '#include <cstddef>
>
> Issue was discovered on the buildbots where an SDK contained a broken
> pkgconf. Make json-c required in order to not even attempt compilation
> when json-c is missing.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  CMakeLists.txt | 7 ++-----
>  blobmsg_json.c | 6 +-----
>  jshn.c         | 6 +-----
>  3 files changed, 4 insertions(+), 15 deletions(-)
>
> diff --git a/CMakeLists.txt b/CMakeLists.txt
> index 1a1b7d5..34a98bd 100644
> --- a/CMakeLists.txt
> +++ b/CMakeLists.txt
> @@ -15,11 +15,8 @@ OPTION(BUILD_LUA "build Lua plugin" ON)
>  OPTION(BUILD_EXAMPLES "build examples" ON)
>
>  INCLUDE(FindPkgConfig)
> -PKG_SEARCH_MODULE(JSONC json-c)
> -IF(JSONC_FOUND)
> -  ADD_DEFINITIONS(-DJSONC)
> -  INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
> -ENDIF()
> +PKG_SEARCH_MODULE(JSONC json-c REQUIRED)
> +INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
>
>  SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c base64.c)
>
> diff --git a/blobmsg_json.c b/blobmsg_json.c
> index dce81e9..35bdc21 100644
> --- a/blobmsg_json.c
> +++ b/blobmsg_json.c
> @@ -17,11 +17,7 @@
>  #include "blobmsg.h"
>  #include "blobmsg_json.h"
>
> -#ifdef JSONC
> -       #include <json.h>
> -#else
> -       #include <json/json.h>
> -#endif
> +#include <json.h>
>
>  bool blobmsg_add_object(struct blob_buf *b, json_object *obj)
>  {
> diff --git a/jshn.c b/jshn.c
> index 1b685e5..061fc7f 100644
> --- a/jshn.c
> +++ b/jshn.c
> @@ -13,11 +13,7 @@
>   * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
>   * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>   */
> -#ifdef JSONC
> -        #include <json.h>
> -#else
> -        #include <json/json.h>
> -#endif
> +#include <json.h>
>
>  #include <string.h>
>  #include <stdlib.h>
> --
> 2.29.2
>
diff mbox series

Patch

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a1b7d5..34a98bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,11 +15,8 @@  OPTION(BUILD_LUA "build Lua plugin" ON)
 OPTION(BUILD_EXAMPLES "build examples" ON)
 
 INCLUDE(FindPkgConfig)
-PKG_SEARCH_MODULE(JSONC json-c)
-IF(JSONC_FOUND)
-  ADD_DEFINITIONS(-DJSONC)
-  INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
-ENDIF()
+PKG_SEARCH_MODULE(JSONC json-c REQUIRED)
+INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
 
 SET(SOURCES avl.c avl-cmp.c blob.c blobmsg.c uloop.c usock.c ustream.c ustream-fd.c vlist.c utils.c safe_list.c runqueue.c md5.c kvlist.c ulog.c base64.c)
 
diff --git a/blobmsg_json.c b/blobmsg_json.c
index dce81e9..35bdc21 100644
--- a/blobmsg_json.c
+++ b/blobmsg_json.c
@@ -17,11 +17,7 @@ 
 #include "blobmsg.h"
 #include "blobmsg_json.h"
 
-#ifdef JSONC
-	#include <json.h>
-#else
-	#include <json/json.h>
-#endif
+#include <json.h>
 
 bool blobmsg_add_object(struct blob_buf *b, json_object *obj)
 {
diff --git a/jshn.c b/jshn.c
index 1b685e5..061fc7f 100644
--- a/jshn.c
+++ b/jshn.c
@@ -13,11 +13,7 @@ 
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
-#ifdef JSONC
-        #include <json.h>
-#else
-        #include <json/json.h>
-#endif
+#include <json.h>
 
 #include <string.h>
 #include <stdlib.h>