easycwmp的编译

easycwmp属于第三方程序,本文记录编译时遇到的问题。

注:此处的编不是交叉编译。编译好后是直接放在CentOS上运行的。

 

具体安装过程查看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.

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'

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

于是在json.c里添加加:

#define is_error(ptr) (ptr == NULL)

 

第三个问题

../src/config.c:125: error: storage size of ‘tm’ isn’t known

找到struct tm 的定义,在time.h里
在src/config.c 添加

#include <time.h>

即可

 

可以看到/usr/include/time.h里定义了struct tm如下:

struct tm
{
int tm_sec; /* Seconds. [0-60] (1 leap second) */
int tm_min; /* Minutes. [0-59] */
int tm_hour; /* Hours. [0-23] */
int tm_mday; /* Day. [1-31] */
int tm_mon; /* Month. [0-11] */
int tm_year; /* Year - 1900. */
int tm_wday; /* Day of week. [0-6] */
int tm_yday; /* Days in year.[0-365] */
int tm_isdst; /* DST. [-1/0/1]*/

#ifdef __USE_BSD
long int tm_gmtoff; /* Seconds east of UTC. */
__const char *tm_zone; /* Timezone abbreviation. */
#else
long int __tm_gmtoff; /* Seconds east of UTC. */
__const char *__tm_zone; /* Timezone abbreviation. */
#endif
};

也可直接把tm 的定义嵌入src/config.c

posted @ 2014-12-29 11:46  wssheng  阅读(1617)  评论(1编辑  收藏  举报