Skip to content

Multiple .so files? #584

@paddor

Description

@paddor

While trying to reduce the size of a snap (snapcraft) package, I noticed that sqlite3, among a few other gems with extensions (nokogiri, ffi) have multiple .so files. After bundling into vendor/bundle, snapping, and installing the snap, this is what's in it:

$ find /snap/my-ruby-app/current/app/vendor/bundle/ruby/3.3.0/gems/  -name '*.so'|xargs du -sh
...
1.5M    /snap/my-ruby-app/current/app/vendor/bundle/ruby/3.3.0/gems/sqlite3-2.1.1-x86_64-linux-gnu/lib/sqlite3/3.1/sqlite3_native.so
1.5M    /snap/my-ruby-app/current/app/vendor/bundle/ruby/3.3.0/gems/sqlite3-2.1.1-x86_64-linux-gnu/lib/sqlite3/3.2/sqlite3_native.so
1.5M    /snap/my-ruby-app/current/app/vendor/bundle/ruby/3.3.0/gems/sqlite3-2.1.1-x86_64-linux-gnu/lib/sqlite3/3.3/sqlite3_native.so
...

It seems there's an .so file for each recent Ruby version like 3.3, 3.2, 3.1?
(Same goes for gems installed on the system itself under ~/.gem/ruby/3.3.3/gems/)

What's the purpose of these? I can't think of a reason, given that they're installed by and for a single Ruby version (3.3.5 in this case)?

Maybe off-topic, but I also noticed that some gems have copies (verified with sha1sum) of their .so files under ~/.gem/ruby/3.3.5/extensions/. What's up with that? Just asking in case anyone knows. I can't find any other info on this.

Thanks for any info or pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions