Problems with the RubyExampleCreateLayOut


#1

I built the ruby create layout example using the latest sketchup api API Version 5.0 in VS2015, but trying to run it in sketchup gives the following error message:

Error: #<LoadError: 126: The specified module could not be found.   - C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/CreateLayOutExample.so>
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/createLayOut.rb:29:in `require_relative'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/createLayOut.rb:29:in `run'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/createLayOut.rb:108:in `block in <module:CreateLayOutExample>'
SketchUp:1:in `call'

The so module file does exist at that location, and I’m not really sure where to go from here. Does anyone have any ideas?


#2

the exact loading code is critical, what do you use?
try this in Ruby Console…

require 'CreateLayOutExample'

does it return true ?

john


#3

I get a very similar output:

require 'CreateLayOutExample'
Error: #<LoadError: 126: The specified module could not be found.   - C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/CreateLayOutExample.so>
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require'
<main>:in `<main>'
SketchUp:1:in `eval'

#4

it may be a Ruby 2.2 issue, does it work in v16?

john


#5

No, still the same issue

Error: #<LoadError: 126: The specified module could not be found.   - C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/CreateLayOutExample.so>
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/createLayOut.rb:29:in `run'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/createLayOut.rb:108:in `block in <module:CreateLayOutExample>'
SketchUp:1:in `call'

I decided to double check that it actually exists, but it does.

File.file?('C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/CreateLayOutExample.so')
true

#6

This is the error message you’d get IF the file did not exist (or you gave the wrong path):
Error: #<LoadError: cannot load such file -- CreateLayOutExample.so>

This is not the error you are seeing. (:Jedi_mind_trick:)

(1) The C-side entry function name suffix must be the same as the library filename.

So if the filename is “CreateLayOutExample.so”, then the entry point
function name must be “Init_CreateLayOutExample()”.

This is a Ruby C extension thang, and not specific to SketchUp.


(2) Make sure the binary library’s bitness matches that of the SketchUp edition.
(You cannot load a 64-bit binary into a 32-bit Ruby subprocess, or visa versa.)


(3) Make sure you use the correct Ruby version libraries …

<2014 : v 1.8.6-p287
2014..2016 : v 2.0.0-p247
2017 : v 2.2.4-p230

… and the correct SDK libraries (for the SketchUp version and bitness.)


#7

I actually just compiled a working extension by grabbing the ruby-c-extension-examples off the Sketchup github and checking out the dev-ruby224 branch.

As for 1, 2 and 3 I had assumed that downloading the latest SDK and compiling an example project would work. Or at least have some helpful information in the README…

Thank you for the pointers but as far as I can tell though everything you pointed out is set correctly.

I’m 99% sure my issue is that I am unfamiliar with Windows development and Visual Studio in particular. Now that I have a working setup learning should be much easier, or at least possible.


#8

I think Thomas (@tt_su) has recently mentioned something about a tutorial on the “to do” list ?


#9

Please see this thread which appear to be related: The SketchUpAPI & LayOutAPI 2017 SDK Bug!