OS: macos
with brew
Ruby version manager: rbenv
I am using bundler
(2.1.4) to deploy my application with all the required gems.
I am currently on Ruby 2.2.4 and trying to update to Ruby 2.5.5. I am also updating the various gems to the latest versions.
I am having an issue with bundler
introducing a dependency for compiled extensions on libruby.2.5.dylib
. This library is in the local .rbenv
folder in the local user's folder. This is causing the application to fail when it is launched on other users' machines because of course this file is not available.
Interestingly this was not happening with the previous version of Ruby (2.2.4). If you take sqlite3
, for example, I have the following.
Ruby 2.2.4 and sqlite-ruby 1.3.13
otool -L /Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/sqlite3-1.3.13/sqlite3/sqlite3_native.bundle
/Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.2.0/extensions/x86_64-darwin-19/2.2.0-static/sqlite3-1.3.13/sqlite3/sqlite3_native.bundle:
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 308.4.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
Ruby 2.5.5 and sqlite-ruby 1.4.2
otool -L /Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.5.0/extensions/x86_64-darwin-19/2.5.0/sqlite3-1.4.2/sqlite3/sqlite3_native.bundle
/Users/dev-user/dev/MCTools/src/mct-tools/ext/gems/ruby/2.5.0/extensions/x86_64-darwin-19/2.5.0/sqlite3-1.4.2/sqlite3/sqlite3_native.bundle:
/Users/dev-user/.rbenv/versions/2.5.5/lib/libruby.2.5.dylib (compatibility version 2.5.0, current version 2.5.5)
/usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 308.5.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
As you can see, there is now a dependency on
/Users/dev-user/.rbenv/versions/2.5.5/lib/libruby.2.5.dylib (compatibility version 2.5.0, current version 2.5.5)
that of course it is not available on other machines. This behaviour is common to all compiled gems (I have 5 of them).
I was hoping that bundle package
would help, but I have the same results if I run it before bundle install
.
Any idea on how I can remove this dependency or any other alternative solution?
When you compile Ruby you can pass
--enable-load-relative
flag to./configure
to remove (some?) of the absolute paths from compiled binaries. This might affect extensions also.