centos6.8 编译安装 log4cxx(liblog4cxx.so.10)


首先下载
====================================================================================================
wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
wget http://mirrors.cnnic.cn/apache/logging/log4cxx/0.10.0/apache-log4cxx-0.10.0.tar.gz

编译安装

====================================================================================================
mkdir ~/libs

tar  zxvf apr-1.5.2.tar.gz

cd apr-1.5.2

./configure --prefix=${HOME}/libs && make && make install
-----------------------------------------------------------------------------------------

cd ..

tar  zxvf apr-util-1.5.4.tar.gz

cd apr-util-1.5.4

./configure --prefix=${HOME}/libs --with-apr=${HOME}/libs && make && make install
------------------------------------------------------------------------------------------------

cd ..

tar  xzvf apache-log4cxx-0.10.0.tar.gz

cd apache-log4cxx-0.10.0

./configure --with-charset=utf-8  --with-apr=${HOME}/libs  --with-apr-util=${HOME}/libs && make && make install

 

====================================================================================================
报错往下看:
进行以下操作:

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’在此作用域中尚未声明

===================================================================================

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在CentOS 7上安装log4cxx,您可以按照以下步骤进行操作: 1. 首先,您需要下载apr和apr-util的安装包。您可以从apr的官方网站(http://apr.apache.org/)下载apr的安装包,从log4cxx的官方网站(http://logging.apache.org/log4cxx/latest_stable/download.html)下载log4cxx安装包。[1] 2. 解压log4cxx安装包。您可以使用以下命令解压安装包: ``` $ tar -zxvf apache-log4cxx-0.10.0.tar.gz ``` 3. 进入解压后的目录: ``` $ cd apache-log4cxx-0.10.0 ``` 4. 运行配置命令,指定安装路径和apr以及apr-util的路径: ``` $ ./configure --prefix=/usr/local/ --with-apr=/usr/local/ --with-apr-util=/usr/local/ --with-charset=utf-8 --with-logchar=utf-8 ``` 5. 编译log4cxx: ``` $ make ``` 6. 使用管理员权限安装log4cxx: ``` $ sudo make install ``` 这样,log4cxx就会被安装在您指定的路径下。请确保您已经正确安装了apr和apr-util,并且路径设置正确。[2] 如果您还需要安装apr-util,您可以按照以下步骤进行操作: 1. 解压apr-util的安装包: ``` $ tar -zxvf apr-util-1.5.4.tar.gz ``` 2. 进入解压后的目录: ``` $ cd apr-util-1.5.4 ``` 3. 运行配置命令,指定安装路径和apr的路径: ``` $ ./configure --prefix=/usr/local --with-apr=/usr/local ``` 4. 编译apr-util: ``` $ make ``` 5. 使用管理员权限安装apr-util: ``` $ sudo make install ``` 这样,apr-util就会被安装在您指定的路径下。请确保您已经正确安装了apr,并且路径设置正确。[3] 请注意,安装过程中可能会出现依赖项缺失或其他错误。如果遇到问题,请根据错误信息进行相应的解决。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值