log4c交叉编译问题解决及简单应用
来源:互联网 发布:simatic it 软件下载 编辑:程序博客网 时间:2024/06/05 21:59
在x86上面编译log4c很简单. 下载log4c-1.2.1.tar.gz, 解压,
./configuremakemake install
That’s OK!
下面说一下交叉编译log4c遇到的问题. 我的./configure如下:
/mnt/share_disk/program-source/log4c-1.2.1/configure –-prefix=/mnt/share_disk/program-files/log4c-ppc/ CC=ppc_82xx-gcc –host=ppc
首先出现如下问题: error: expat.h: No such file or directory
expat是什么东西呢? Expat is James Clark’s Expat XML parser library in C. It is a stream oriented parser that requires setting handlers to deal with the structure that the parser discovers in the document.
解决方法1: 下载expat源代码, 编译安装到某个路径下面, 然后在configure时用–with-expat-prefix指定所安装的路径.
解决方法2: 直接–without-expat, 这时log4c将自己用yacc and lex for parsing xml, 我直接用该方法.反正对解析效率没有要求.
接下来的问题是: undefined reference to `rpl_realloc` undefined reference to `rpl_malloc`.
原来, 交叉编译时, 会将下面三个变量设为no, 我们强行设置为yes即可. 在configure前执行
export ac_cv_func_realloc_0_nonnull=${ac_cv_func_realloc_0_nonnull=yes}export ac_cv_func_realloc_works=${ac_cv_func_realloc_works=yes}export ac_cv_func_malloc_0_nonnull=yes简单示例如下:
#include "log4c.h"int main(){ int i = 0; if (log4c_init()) { printf("aaaaaaaaaaa"); return 0; } log4c_category_t* mycat = log4c_category_get("octeon_cat"); printf("mycat %p.\n", mycat); while (1) { log4c_category_log(mycat, LOG4C_PRIORITY_DEBUG, "Hello World!, %d", i); i++; if (i >= 1000) break; } return 0;}
xml配置文件如下:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE log4c SYSTEM ""><log4c version="1.2.1"> <config> <bufsize>0</bufsize> <debug level="2"/> <nocleanup>0</nocleanup> <reread>1</reread> </config> <!-- root category ========================================= --> <category priority="notice"/> <category priority="debug" appender="octeon_appender"/> <!-- default appenders ===================================== --> <appender layout="basic"/> <appender layout="dated"/> <appender layout="basic"/> <rollingpolicy maxsize="1048576" maxnum="10" /> <appender logdir="./" prefix="octeon_mgmt" layout="dated" rollingpolicy="octeon_roll" /> <!-- default layouts ======================================= --> <layout/> <layout/></log4c>
- log4c交叉编译问题解决及简单应用
- 交叉编译工具的安装及问题解决
- 交叉编译实践-交叉编译原理与简单应用
- libwebsocket 交叉编译及应用注意细节
- openssh交叉编译移植过程及问题解决方法
- mingw编译log4c
- 编译原理及交叉编译
- 嵌入式Linux ALSA工具交叉编译问题解决
- Linux_ubuntu下交叉编译权限问题解决方法
- radvd移植到arm交叉编译问题解决
- faac 1.28的交叉编译与问题解决
- BREW 应用的交叉编译
- 简单科普一下“交叉编译”
- 交叉编译链简单介绍
- 交叉编译的简单心得
- [allmake] -- 交叉编译原来如此简单
- Log4C++
- libc编译及问题解决
- ant不是内部命令也不是外部命令问题的解决方法
- File Geodatabase与Personal Geodatabase
- 如何使tableLayoutPanel 不闪烁
- 菜鸟初始代码旅程——删除记录功能
- [转]使用CSS3阴影制作立体感效果
- log4c交叉编译问题解决及简单应用
- Oracle中Instr用法
- 【乾言龙语】从今天第一篇博客起,用心记录下我的IT之路,不论未来如何……
- DP poj1745 Divisibility
- 【重新上本科】堆排序【下】
- <script type="text/javascript">
- MySql 中导入txt文本文件数据1
- 解决SQL Server 连接服务器 错误2
- centos下nginx的启动