Linux下log4cxx编译

  • 下载解压

log4cxx下载地址:http://logging.apache.org/log4cxx/

apr-util、apr下载地址:http://apr.apache.org/download.cgi


解压
 

$tar -zxvf apr-1.4.6.tar.gz
$tar -zxvf apr-util-1.4.1.tar.gz
$tar -zxvf apache-log4cxx-0.10.0.tar.gz
  • 编译前准备

注意配置前需进行以下操作:
1.vim src/main/cpp/inputstreamreader.cpp
增加#include <string.h>;
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/inputstreamreader.h>
#include <log4cxx/helpers/exception.h>
#include <log4cxx/helpers/pool.h>
#include <log4cxx/helpers/bytebuffer.h>
+
#include <string.h>
+
否则会出现inputstreamreader.cpp:66: error: 'memmove' was not declared in this scope
make[3]: *** [inputstreamreader.lo] 错误 1

2.vim src/main/cpp/socketoutputstream.cpp
增加#include <string.h>;
#include <log4cxx/logstring.h>
#include <log4cxx/helpers/socketoutputstream.h>
#include <log4cxx/helpers/socket.h>
#include <log4cxx/helpers/bytebuffer.h>
+
#include <string.h>
+
否则会出现socketoutputstream.cpp:52: error: 'memcpy' was not declared in this scope


3.vim src/examples/cpp/console.cpp
增加#include <string.h>,#include <stdio.h>;
+
#include <stdio.h>
+
#include <stdlib.h>
+
#include <string.h>
+
#include <log4cxx/logger.h>
#include <log4cxx/consoleappender.h>
#include <log4cxx/simplelayout.h>
#include <log4cxx/logmanager.h>
#include <iostream>
#include <locale.h>
否则会出现
console.cpp: In function ‘int main(int, char**)’:
console.cpp:58: 错误:‘puts’在此作用域中尚未声明

  • 编译安装

首先安装apr-1.4.6,切换cd apr-1.4.6,配置./configure --prefix=/usr/local/apr,接着make, make install

接着安装apr-util-1.4.1,切换至cd ../apr-util-1.4.1, ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr,接着make,make install;

最后安装apache-log4cxx-0.10.0,切换cd ../apache-log4cxx-0.10.0,配置./configure --prefix=/usr/local/log4cxx --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-charset=utf-8 --with-logchar=utf-8

./configure --prefix=build_path --with-apr=apr_path --with-apr-util=apr-util_path --with-charset=utf-8 --with-logchar=utf-

 

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值