移植jansson库
1. 确认configure脚本
若是工程中没有,使用autoreconf
工具生成即可。
autoreconf -i
2. 查看configure文件里的可用选项
./configure --help
3. 依据编译环境,将选项填入合适的值
如:
./configure --host=mips-linux CC=/home/hany/work/t31/mips-gcc472-glibc216-64bit/bin/mips-linux-uclibc-gnu-gcc LDFLAGS=-lm
make -j4
FAQ
Q: 编译时遇到如下错误提示:
./libjansson.a(value.o): In function `json_real':
/nfsroot/jshon/jansson-2.14/src/value.c:926: undefined reference to `__isnan'
/nfsroot/jshon/jansson-2.14/src/value.c:926: undefined reference to `__isinf'
./libjansson.a(value.o): In function `json_real_set':
/nfsroot/jshon/jansson-2.14/src/value.c:946: undefined reference to `__isnan'
/nfsroot/jshon/jansson-2.14/src/value.c:946: undefined reference to `__isinf'
A: undefined reference to `__isnan'是缺少数学函数库你没有链接。再加上 -lm 的选项,OK!