Clone this repo:
  1. 75d6323 Ignore unused parameter warnings by Michael Bestas · 4 years, 4 months ago fourteen thirteen twelve
  2. 7c66b77 libjson: Remove dependency on kernel headers by Brandon McAnsh · 6 years ago
  3. c37ebed Merge 8d46a3c691776bcda7ad0e55c481b41d41235e33 on remote branch by Linux Build Service Account · 2 years, 6 months ago
  4. 8d46a3c json-c: compilation fix for qssi target by Eruvaram Kumar Raja Reddy · 2 years, 8 months ago
  5. a5f864b json-c: Remove LOCAL_COPY_HEADERS by Jason Wojcik · 2 years, 9 months ago

json-c

Building on Unix with git, gcc and autotools

Home page for json-c: https://github.com/json-c/json-c/wiki

Caution: do NOT use sources from svn.metaparadigm.com, they are old.

Prerequisites:

  • gcc, clang, or another C compiler
  • libtool

If you're not using a release tarball, you'll also need:

  • autoconf (autoreconf)
  • automake

Make sure you have a complete libtool install, including libtoolize.

json-c GitHub repo: https://github.com/json-c/json-c

$ git clone https://github.com/json-c/json-c.git
$ cd json-c
$ sh autogen.sh

followed by

$ ./configure
$ make
$ make install

To build and run the test programs:

$ make check

Linking to libjson-c

If your system has pkgconfig, then you can just add this to your makefile:

CFLAGS += $(shell pkg-config --cflags json-c)
LDFLAGS += $(shell pkg-config --libs json-c)

Without pkgconfig, you would do something like this:

JSON_C_DIR=/path/to/json_c/install
CFLAGS += -I$(JSON_C_DIR)/include/json-c
LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c