【问题标题】:MongoDB v3.2 compiled binaries are over 500 MBMongoDB v3.2 编译的二进制文件超过 500 MB
【发布时间】:2016-05-21 20:10:11
【问题描述】:

我刚刚通过使用非常标准的标志编译MongoDB v3.2scons,正如他们的wiki 中所记录的那样:

scons core --ssl --disable-warnings-as-errors
scons install --prefix /usr/local --disable-warnings-as-errors

这行得通,但二进制文件相当大,每个 200~500 MB:

# for x in mongo*; do file $x; du -sh $x; done
mongo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=69333c37057636d730d21940550f6ecc45f7474b, not stripped
196M    mongo
mongod: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=1d1b8122b74729d042fee025a1bdb2999fe99fcc, not stripped
521M    mongod
mongoperf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5bfb47e755271efbdbed1de5b8130a41da5d026e, not stripped
511M    mongoperf
mongos: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6409c6eb3d4f771fd9e41fbc87985384cc7b5453, not stripped
254M    mongos

这看起来很奇怪......就像我忘记了一些压缩标志或类似的东西。我相信这与file 命令输出中的not stripped 有关。我如何告诉scons 剥离/压缩它?

【问题讨论】:

  • 只需运行strip mongod,也可以运行man strip 了解详情。 :-)
  • 谢谢先生,效果很好:)

标签: mongodb compilation scons


【解决方案1】:

为了完整起见,如 cmets 中所述,来自 GNU 开发工具strip 是答案:

# for x in mongo*; do strip -s $x; file $x; du -sh $x; done                                                               
mongo: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=69333c37057636d730d21940550f6ecc45f7474b, stripped
16M     mongo
mongod: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=1d1b8122b74729d042fee025a1bdb2999fe99fcc, stripped
30M     mongod
mongoperf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=5bfb47e755271efbdbed1de5b8130a41da5d026e, stripped
30M     mongoperf
mongos: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=6409c6eb3d4f771fd9e41fbc87985384cc7b5453, stripped
14M     mongos

【讨论】:

    猜你喜欢
    • 2019-10-02
    • 1970-01-01
    • 2013-01-03
    • 2017-07-29
    • 2014-06-08
    • 1970-01-01
    • 2011-01-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多