postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.91k stars 255 forks source link

Size differences? #351

Closed zenspider closed 4 years ago

zenspider commented 5 years ago

I get that ruby-install does rdoc/ri by default (THANK YOU) so the builds are going to have more in them than ruby-build... but the binary sizes are also vastly larger. I haven't dug too deep with nm or the like, but is there something I can/should do to bring these sizes down? They're currently ~4-8x larger:

9986 % find .rbenv.dead .rubies -name \*.a | xargs du -h
1.5M    .rbenv.dead/versions/2.5.5/lib/libruby.2.5.5-static.a
1.6M    .rbenv.dead/versions/2.6.3/lib/libruby.2.6-static.a
2.8M    .rbenv.dead/versions/parser/lib/libruby-static.a
1.4M    .rbenv.dead/versions/2.4.6/lib/libruby-static.a
3.1M    .rbenv.dead/versions/parser25/lib/libruby.2.5.4-static.a
3.0M    .rbenv.dead/versions/trunk-cov/lib/libruby-static.a
3.0M    .rbenv.dead/versions/parser24/lib/libruby-static.a

 13M    .rubies/ruby-2.5.6/lib/libruby.2.5.6-static.a
 14M    .rubies/ruby-2.6.4/lib/libruby.2.6-static.a
 12M    .rubies/ruby-2.4.7/lib/libruby-static.a
postmodern commented 4 years ago

Beyond the various CFLAGS and ./configure options which ruby-build sets in certain situations, it sets --enable-shared by default in all of it's build recipes.

$ ldd ~/.rubies/ruby-2.7.1/bin/ruby | grep ruby
$ nm -D ~/.rubies/ruby-build-2.6/bin/ruby | grep ruby
    libruby.so.2.6 => /home/postmodern/.rubies/ruby-build-2.6/lib/libruby.so.2.6 (0x00007f9d1aea2000)

So most of the bulk is in the libruby.so.2.6.4.

$ du -h ~/.rubies/ruby-build-2.6/lib/libruby.so.2.6.4
9.1M    /home/postmodern/.rubies/ruby-build-2.6/lib/libruby.so.2.6.4

You can review how ruby-install invokes ./configure here.