bianbian coding life

便便代码人生: 关注技术, 翻译文档, 偶尔动动手

[原] 减小nginx编译后的文件大小 (Reduce file size of nginx)

Posted by bianbian on 2008-03-13 10:21

本文Tags: , , ,

默认的nginx编译选项里居然是用debug模式(-g)的(debug模式会插入很多跟踪和ASSERT之类),编译以后一个nginx有好几兆。
去掉nginx的debug模式编译,编译以后只有375K(nginx-0.5.33, gcc4)。
在 auto/cc/gcc,最后几行有:
# debug
CFLAGS=”$CFLAGS -g”
注释掉或删掉这几行,重新编译即可。-g参数用法详见这篇blog:[原]Linux下的c/c++ GDB调试

Nginx uses debug mode (-g) in compiling by default, which result in several MB of it’s size.
After debug disabled, the file size of nginx reduced to 375K (nginx-0.5.33, gcc4).
open auto/cc/gcc, find this at last several lines:
# debug
CFLAGS=”$CFLAGS -g”
delete it, and recompile. More of -g: Linux c/c++ GDB debug

标签: , , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)