惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
The Register - Security
The Register - Security
量子位
Security Latest
Security Latest
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
C
CXSECURITY Database RSS Feed - CXSecurity.com
MyScale Blog
MyScale Blog
J
Java Code Geeks
Apple Machine Learning Research
Apple Machine Learning Research
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
Spread Privacy
Spread Privacy
Jina AI
Jina AI
博客园 - 【当耐特】
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
G
GRAHAM CLULEY
宝玉的分享
宝玉的分享
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Blog of Author Tim Ferriss
V
Vulnerabilities – Threatpost
有赞技术团队
有赞技术团队
T
Tor Project blog
H
Hacker News: Front Page
A
Arctic Wolf
NISL@THU
NISL@THU
A
About on SuperTechFans
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
V
V2EX
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
I
InfoQ
D
Docker
L
LINUX DO - 最新话题
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42

博客园 - CrunchYou

VMWare虚拟机Bridged类型网卡ping不通的原因和解决办法 CentOS以及Oracle数据库发展历史及各版本新功能介绍, 便于构造环境时有个对应关系 virtio-blk简介[转] UML基础与Rose建模实训教程 实现阶段, 详细设计, 编码过程中的控制与管理 应用系统部署后远程备份 POSIX正则表达式 修改msde登录方式,设置sa密码为空 windows脚本调用批处理 诗经 全文 转:ADO.NET连接字符串 MindProject R6025解决 颜色的搭配适用,摘自某论坛 准确理解SO_REUSEADDR [转]UDP穿透NAT的原理与实现(UDP“打洞”原理) [转载]QQ空间技术架构之深刻揭密 Eclipse快捷键大全(转载) openssl的编译 - linux boost编译过程 -- linux
log4cxx编译过程–linux
CrunchYou · 2013-04-27 · via 博客园 - CrunchYou

前面有一篇Windows下的log4cxx编译, 这里记录下在linux上的编译过程.

环境:CentOS6.3 gcc-4.4.6

-> view os version: lsb_release -a
       lsb_release prints certain LSB (Linux Standard Base) and Distribution

information

#lsb_release -a
LSB Version:    :core-4.0-ia32:core-4.0-noarch:graphics-4.0-ia32:graphics-

4.0-noarch:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.3 (Final)
Release:        6.3
Codename:       Final

-> view kerenl and gcc version: -cat /proc/version

# cat /proc/version
Linux version 2.6.32-279.el6.i686 (mockbuild@c6b9.bsys.dev.centos.org) (gcc

version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 10:59:55

UTC 2012

log4cxx版本:
apache-log4cxx-0.10.0
log4cxx是在apache portable runtime library: apr-1.4.6  apr-util-1.5.2

第一步: 编译apr
tar -xcf apr-1.4.6.tar.gz -C /usr/local/apr/
cd /usr/local/apr/apr-1.4.6
./configure --prefix=/usr/local/apr
make
make install
///////////////////
./configure --help 可以看帮助. --prefix=/usr/local/apr是配置安装目录, apr最终安

装在/usr/local/apr下.
make - 编译apr
make install - 安装, 就是将include, lib, bin文件拷贝到/usr/local/apr下, 并建立相

应的目录结构.

第二步: 编译apr-util
apr-util需要以来apr, 所以需先编译apr
tar -xcf apr-util-1.5.2.tar.gz -C /usr/local/apr-util/
cd /usr/local/apr-util/apr-util-1.5.2
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/
make
make install
////////////////////////
--with-apr - 此option指明apr的路径

第三步: 编译log4cxx
解压->到解压后的目录
./configure --prefix=/usr/local/log4cxx/ --with-apr=/usr/local/apr/ --with-

apr-util=/usr/local/apr-util/
make
////////////
make过程中, 会遇到错误发生
第一个错误:
inputstreamreader.cpp:66: error: 'memmove' was not declared in this scope
memmove没有申明, 查linux编程文档, memmove在string.h中申明.

./src/main/cpp/inputstreamreader.cpp -> 增加 #include <string.h>

./src/main/cpp/socketoutputstream.cpp -> 增加 #include <string.h>

./src/examples/cpp/console.cpp -> 增加 #include <stdio.h> #include <string.h>

///////////////
make
make install

最后配置/etc/ld.so.conf - 需要root权限
增加:
/usr/local/apr/lib
/usr/local/apr-util/lib
/usr/local/log4cxx/lib

若没有root权限, 只有通过LD_LIBRARY_PATH来配置lib path
vi $HOME/.bash_profile
增加
export LD_LIBRARY_PATH=/usr/local/apr/lib:/usr/local/apr-util/lib:/usr/local/log4cxx/lib:.:$LD_LIBRARY_PATH
source .bash_profile -->生效
echo $LD_LIBRARY_PATH可以查看.

---> OK.

如何使用, 我没用, 听说log4cxx有内存泄露, 我用了自己写的log代码, 网上有很多简单的用法介绍. 因为别人编写的模块中使用了这个库, 所以这里环境必须配齐.