I have been successfully using compiled gems with SU 2015 to 2018 on macos. A couple of examples are SQLite3 (1.3.13) and ruby_clipper 18.104.22.168.2.
This is my workflow on macos (A different workflow works on Win)
- I use
rbenvto manage local Ruby installations
- SU 2015 - 2.0.0-p247
- SU 2017 & 2018 - 2.2.4
- SU 2019 & 2020 - 2.5.5p157
Most of the tools I need are installed via
In order to use compiled gems I first install them on my local ruby installation and then
gem_extension.bundle file in my extension. It is a bit more involved than that, but you get the point.
Everything works great for SU2015/16/17/18. Unfortunately this is not working anymore for SU2019 or SU2020.
When I require the
gem_extension.bundle file I receive the error
Error: #<LoadError: incompatible library version - /Users/xxxxxxx/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> /Applications/SketchUp 2020/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require' /Applications/SketchUp 2020/SketchUp.app/Contents/Frameworks/Ruby.framework/Versions/2.5.5/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require' <main>:in `<main>' SketchUp:1:in `eval'
Every gem gives exactly the same error. If I require them in
pry for example they are loaded without any issue and they work as expected.
I know that Gems are not officially supported, but I was hoping anyway that someone more knowledgeable than me could help.
I don’t know if this helps, but if you run
otool -L on the two
bundles these are the 2 different outputs
sqlite 1.3.13 - Working bundles for SU < 2019
/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)
sqlite 1.3.13 - Not working for SU >= 2019
/Users/xxxx/.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)
The first thing that you notice is that the dependence on
libruby.2.5.dylib is not present in the previous versions. From some posts that I read on this forum I think I understood that the SU Ruby Framework has changed the files that it includes and the way they are named. For example here and here. Honestly this is a bit over my head.
I have also tried with the latest sqlite3 1.4.2 and with various compilation options (using sqlite from
brew for example), but with no success.
Any idea? Has someone managed to run sqlite3 successfully on macos SU2019/20?
Thanks for looking.