标签归档:debug

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

默认的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