Unable to load sqlite3 library in Sketcup Pro 2019 version

Hi Team,

I am a Sketchup Pro user and have on a ruby plugin. While using the plugin in recent/latest Sketchup 2019 version, the plugin is showing some issues with sqlite3 library.

The sqlite3 library is working in the terminal(command prompt) with same Ruby version 2.5.1.

But, it is not loading inside Sketchup 2019, working fine in 2018 version.

Error logs:

Error: #<Sequel::AdapterNotFound: LoadError: 126: The specified module could not be found.   - ***/gems/sqlite3/sqlite3_native.so> - This is available in this location.
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:59:in `require'
...
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/singleton.rb:141:in `new'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/singleton.rb:141:in `block in instance'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/singleton.rb:139:in `synchronize'
C:/Program Files/SketchUp/SketchUp 2019/Tools/RubyStdLib/singleton.rb:139:in `instance'
C:/SunDAT/loader.rb:23:in `<top (required)>'
C:/Program Files/SketchUp/SketchUp 2019/Tools/extensions.rb:197:in `require'
C:/Program Files/SketchUp/SketchUp 2019/Tools/extensions.rb:197:in `load'
C:/Users/Arjun/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Plugins/sundat_extension.rb:15:in `register_extension'
C:/Users/Arjun/AppData/Roaming/SketchUp/SketchUp 2019/SketchUp/Plugins/sundat_extension.rb:15:in `<top (required)>'

Kindly let me know, how to resolve this.

Thanks,
Mallikarjuna.

Here is a thread that might give some clues

Pinging @NiCa60

Hi, Thanks for your reply.

I am facing this issue with Sketchup 2019 only, and no issues with 2018 version.

As mentioned in this, Sqlite installation is success and working fine in IRB also.

The only issue is not working in Sketchup 2019 alone…

#SketchupTeam: Kindly let me know how to resolve this.

Thanks,
Mallikarjuna.

The SketchUp team has no control over third party extension developers, so you need to contact them, or get help from other users, which was why I pinged @NiCa60
But maybe he might not be involved with this user forum, anymore.

Normally this error means the file exists, but it can’t find a dll it should link to or load. Try adding msys64/mingw64/bin (add prefix) to ENV['PATH'], then require it.

In this case, it’s looking for dll’s that are part of the MSYS2/MinGW sqlite3 package. I believe that would be libsqlite3-0.dll

Hi,

Thanks for your reply,

Tried this, but not working…

Kindly let me know other options, if any.

Regards,
Mallikarjuna.

Using gems isn’t something we support. In a shared environment like SketchUp it’s problematic to avoid version conflicts. (See more details: How to use a local ruby gem inside a Sketchup Extension - #15 by tt_su)

In addition to the conflict issue, some extensions require compiling, which doesn’t work out of the box on Windows because there is no default system compiler to do so, and you cannot expect end users to have this available.

You could try to install it in your local system Ruby installation, Then copy the gem into your extension. (Installing ruby gems in Sketchup - #2 by tt_su) That would be ok for your own usage. But, if you plan to distribute it I would recommend you fork the gem and wrap it in your own namespace, then build and bundle it into your extension’s namespace.

That way you avoid clashing with other extensions (requirement to be listed on Extension Warehouse). And you avoid the potential gem install/Gem.install issues on user’s machine. (Might fail due to expired SSL certs on older SU versions. Freezes SketchUp for the duration of the gem installation.)

Ok. First, everything Thomas said. Extension gems are almost impossible to use in a ‘generic plugin’ for public use. Conversely, if you need it for a controlled ‘local users’ application where you can perform additional setup steps, one should be able to use anything that can be used with stand-alone Ruby.

That said, this may not be trivial. Also, at present, I don’t have (or need) SketchUp, although I’ve used it in the past. Conversely, many would consider me a ‘knowledgeable windows Ruby user’.

So, if you want to move forward:

  1. I just quickly built SQLite3 on Ruby trunk (2.7), and using the example code at GitHub - sparklemotion/sqlite3-ruby: Ruby bindings for the SQLite3 embedded database, it’s working fine. I did need to install mingw-w64-x86_64-dlfcn, which isn’t done automatically.

  2. How did you install the gem in SketchUp? Are you sure that’s correct?

  3. If you’re not sure about 2, using the --user-install option should make it available in SketchUp, but that depends on how Trimble setup Ruby. If the value of Gem.user_dir matches in both stand-alone Ruby and SketchUp Ruby, it can be used as a common gem install location.