linux减少静态库大小,如何减小log4cplus静态库的大小(How to reduce the size of static library of log4cplus)...

如何减小log4cplus静态库的大小(How to reduce the size of static library of log4cplus)

我试过log4cplus。 它非常方便,符合我们的要求。 唯一的问题是它太大了。 编译之后,它的静态库在Linux(64位)上大约是11M。

是否可以通过在构建静态库时指定一些参数来减小其静态库的大小?

我试过'strip --strip-all'但是在将库链接到我的程序时我得到了一些未定义的引用错误。

I tried log4cplus. It is quite handy and meet our requirement. The only problem of it is it is too big. After compiling, the static library of it is about 11M big on Linux(64bit).

Is it possible reduce the size of its static library by specifying some parameters when building it?

I tried 'strip --strip-all' but I got some undefined reference error when linking the library to my program.

原文:https://stackoverflow.com/questions/13944360

更新时间:2019-12-01 14:01

最满意答案

您可以手动编辑源并删除不使用的Appender。 还要意识到默认情况下,编译的库确实包含调试信息。 第三,11 MiB真的没什么。

You could manually edit the source and remove Appenders that you will not be using. Also realize that by default, the compiled library does contain debugging information. And third, 11 MiB is really nothing.

2012-12-19

相关问答

Windows UNICODE构建是使用TCHAR等构建的,定义为wchar_t等。当不使用定义为构建的UNICODE构建时将TCHAR定义为char等。 构建一个定义了UNICODE库并尝试在未定义UNICODE的项目中链接它将导致链接器错误,因为TCHAR的定义不匹配; char与wchar_t 。 要更正此问题,请使用UNICODE (和_UNICODE )的一致定义构建所有必需的库和项目。 这可以用任何一个来完成; #define UNICODE

#define _UNICODE

或者在

...

请尝试附加到机票#282的补丁 。 这应该已经在1.1.x分支上修复了。 Please try the patch attached to ticket #282. This should be fixed on 1.1.x branch already.

在尝试使用它之前,您需要配置库。 doConfigure()函数设置appender,没有它将不会有输出。 使用log4cplus::Initializer initializer; 在你的ctor是错误的。 它会初始化库并在构造函数的最后取消初始化它。 initializer对象必须在整个库的使用过程中生效。 You need to configure the library before you try to use it. The doConfigure() function sets up

...

您可以手动编辑源并删除不使用的Appender。 还要意识到默认情况下,编译的库确实包含调试信息。 第三,11 MiB真的没什么。 You could manually edit the source and remove Appenders that you will not be using. Also realize that by default, the compiled library does contain debugging information. And third, 11

...

SysLogAppender appender发送到OS syslog。 它无法控制旋转。 这是让你使用你的系统日志实现配置来设置的。 SysLogAppender appender is sending to OS syslog. It has no control over the rotation. That is for you to set up using your syslog implementation configuration.

此错误已经出现过几次。 似乎可以卸载名为Autodesk 360的东西,从而解决了这个问题。 This error has shown up a few times already. It appears that something called Autodesk 360 can be uninstalled, which fixes the issue.

RollingFileAppender是线程安全的,它不是异步的。 要获得异步性,您必须围绕它包装AsyncAppender。 与单线程相比,从多个线程使用RollingFileAppender没有什么特别之处。 在Appender::doAppend()为所有appender完成同步。 RollingFileAppender is thread safe and it is not asynchronous. To get asynchronicity, you would have to wr

...

这是一个问题Windows以及fstream及其streambuf如何打开文件。 问题#167 : 基本上,问题是底层的Win32文件HANDLE没有打开FILE_SHARE_DELETE标志。 除了共享删除之外,此标志允许重命名具有对其打开句柄的文件。 所以,最重要的是,它是可以解决的,但是对于codecvt facet所有必要的支持来创建自己的streambuf是非常困难的,我从来没有完成它。 This is an issue Windows and how fstream and its s

...

尝试更改此行 log4cplus.logger.cpuLoad.child=FATAL, FILEAPPENDER

进入这个 log4cplus.logger.cpuLoad.child=INHERITED, FILEAPPENDER

这应该够了吧。 编辑: @jaguzu:我不太了解log4j,但在我看来,你想要实现的是在log4j和log4cplus使用的模型之外:要么显式设置日志级别,要么从父级记录器继承它。 您可以使用记录器阈值和appender过滤器实现更多过滤,但这两者都不是从父记

...

我通过猜测大声笑出来了! log4cplus.rootLogger=DEBUG, ROLLING

log4cplus.appender.STDOUT=log4cplus::ConsoleAppender

log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout

log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S} [%t] %-5p %c{2} %%

...

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值