Ubuntu16.04安装json-c

1. 安装依赖

sudo apt-get install git gcc clang libtool autoconf automake doxygen valgrind

一些版本要求,如果版本过低可以从github上使用源码安装。

  1. libtool≥2.2.6b
  2. autoconf≥2.64
  3. automake≥1.13
  4. doxygen≥1.8.13

2. 安装

git clone https://github.com/json-c/json-c.git
cd json-c
sh autogen.sh
./configure
make
sudo make install
  • 测试:
make check

注意

为了在make编译的过程中使用json-c,需要修改makefile的信息:

  • 已经安装pkgconfig
CFLAGS += $(shell pkg-config --cflags json-c)
LDFLAGS += $(shell pkg-config --libs json-c)
  • 未安装pkgconfig
JSON_C_DIR=/path/to/json_c/install
CFLAGS += -I$(JSON_C_DIR)/include/json-c
LDFLAGS+= -L$(JSON_C_DIR)/lib -ljson-c

猜你喜欢

转载自www.cnblogs.com/031602523liu/p/9925182.html