轉自:http://www.cnblogs.com/031602523liu/p/9925182.html
1. 安裝依賴
sudo apt-get install git gcc clang libtool autoconf automake doxygen valgrind
一些版本要求,如果版本過低可以從github上使用源碼安裝。
libtool≥2.2.6b
autoconf≥2.64
automake≥1.13
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