首页 > 代码库 > easycwmp在pc上的编译

easycwmp在pc上的编译

easycwmp属于第三方程序,我在编译时遇到了几个问题,困扰自己很久,也怪自己没静下心分析,今天终于解决了,在此做个总结

一.具体安装过程请看README安装说明文档

二.第一个问题

checking for MICROXML... configure: error: Package requirements (microxml) were not met:

No package ‘microxml‘ found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables MICROXML_CFLAGS
and MICROXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

microxml是之前安装easycwmp的README装的,没问题,可以排除。

pkg-config的作用是检查程序赖以安装的各个库及文件是否安装,各个库的路径以.pc结尾,于是找到与microxml同一目录下的microxml.pc文件,里面果然定义了

1 prefix=/usr
2 exec_prefix=/usr
3 libdir=${exec_prefix}/lib
4 includedir=${prefix}/include
5
6 Name: microxml
7 Description: micro XML library
8 Version: 1.0
9 Libs: -L${exec_prefix}/lib -lmicroxml -lpthread
10 Cflags: -I${prefix}/include -D_THREAD_SAFE -D_REENTRANT

只是用./configure --enable-debug --enable-devel --enable-acs=multi --enable-jsonc=1编译时系统找不到而已

于是在命令行给出路径

./configure MICROXML_CFLAGS="-I/usr/include/ -D_THREAD_SAFE -D_REENTRANT" MICROXML_LIBS="-L/usr/lib -lmicroxml -lpthread" --enable-debug --enable-devel --enable-acs=multi --enable-jsonc=1

Package requirements (microxml) were not met的问题解决。

三./home/weishusheng/cwmp_client/easycwmp1.0.1/bin/../src/json.c:168: undefined reference to `is_error‘

于是找到is_error的定义,在json-c/bits.h:有这样的定义#define is_error(ptr) (ptr == NULL)

于是在json.c里加#define is_error(ptr) (ptr == NULL)进去

问题解决。

 

easycwmp在pc上的编译