M
Modular•2y ago
ubj

Larger Than Expected Binaries

I just tried compiling the "hello.🔥" file on my computer, and the binary has a size of 1.7 MB. Minor nitpick, but that's much larger than the 22 KB advertised on the blog post. Any ideas why I'm getting a larger binary file? (I'm using Ubuntu 20.04)
4 Replies
Jack Clayton
Jack Clayton•2y ago
Hi @ubj thanks for reporting, we're currently looking into this, you can track progress on this ticket: https://github.com/modularml/mojo/issues/599
GitHub
[BUG]: Mojo hello world binary size unreasonably large · Issue #599...
Bug description After building the HelloWorld program, the size of the binary is over 1 MB -rw-r--r-- 1 1000 36 Sep 7 17:57 hello.mojo -rwxr-xr-x 1 1000 1.7M Sep 7 17:58 hello whereas the example f...
ubj
ubjOP•2y ago
Fantastic, thanks!
ksandvik
ksandvik•2y ago
But if the binaries are staticly linked, they will not be small, more like the size of Golang or Rust.
aguspiza
aguspiza•2y ago
it does not seem static: mojo$ ldd hello linux-vdso.so.1 (0x00007ffd5e73b000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f216d08f000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f216d06c000) libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f216d03c000) libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f216ce5a000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f216cd0b000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f216ccf0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f216cafc000) /lib64/ld-linux-x86-64.so.2 (0x00007f216d1f9000)

Did you find this page helpful?