C Extension on OSX crashes SU
-
-
@thomthom said:
require "/Users/thomas/Sketchup Plugins/Vertex Edit/CExt/TT_Hamster"
I can't require /TT_Hampster from TT_Hampster.bundle, I need a load ruby or something,
other plugins I have that use .bundle (that are also located in the SU plugins folder) access them through separate load rubies
other apps that use .bundles keep the bundles in the separate system folders
so, I guess I just don't know where to put it or how to open, but I'm willing to try following detailed instruction if it helps
john
-
@driven said:
I can't require /TT_Hampster from TT_Hampster.bundle, I need a load ruby or something,
TT_Hamster.bundle instead of TT_Hampster.bundle would help...
...or was that just a typo in the post? -
a typo in the post, but I just spotted
>> require "/Users/thomas/Sketchup Plugins/Vertex Edit/CExt/TT_Hamster"
to be on the safe side shouldn't your path be
>> require "/Library/Application\ Support/Google\ SketchUp\ 7/SketchUp/Plugins/Vertex Edit/CExt/TT_Hamster"I know some plugins run from other folders quite happily, but for SU it can be a problem...
just a thought
john
-
From the IRB it should work regardless.
@driven said:
I know some plugins run from other folders quite happily, but for SU it can be a problem...
Yes, all depending on how they locate their files. My plugin uses the path to the loading .rb as base to determine the subfolders. Works fine on PC.
I set it up in an isolated folder for development, with the development folder added to the include path.But it is strange that you can't even load it from IRB...
-
@thomthom said:
But it is strange that you can't even load it from IRB...
I'm not very familiar with IRB, so it probably my error.
maybe you could give me more specific instruction...when I unzip d/l file I put "TT_Hamster.bundle" into my SU plugins folder
in SU Ruby Console I run your .rb code and get
> require 'mkmf' create_makefile("TT_Hamster") Error; #<LoadError; (eval);507;in `require'; no such file to load -- mkmf> (eval);507 (eval);507
so, what am I doing wrong??
john -
I'm confused - are you using the SU Ruby Console or the IRB to test it?
> require 'mkmf'
Ohhh - now I see. That bit is what I used to compile the extension.TT_Hamster.bundle
is the compiled result of that.
You should only need to
require "TT_Hamster"
- this assumes that TT_Hamster.bundle is in the current working directory. -
I checked and have a similar problem. I have only been testing my extension in SketchUp on Windows and IRB on Windows/Mac. I'm going to look into it too and will post anything I find here.
Dan
-
@thomthom said:
I'm confused - are you using the SU Ruby Console or the IRB to test it?
> require 'mkmf'
Ohhh - now I see. That bit is what I used to compile the extension.TT_Hamster.bundle
is the compiled result of that.
You should only need to
require "TT_Hamster"
- this assumes that TT_Hamster.bundle is in the current working directory.You have to link as a flat namespace otherwise it won't work on OSX.
LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
-
I don't know at all what that line actually do, but I replaced what was generated by the extconf.rb file:
LDSHARED = cc -arch ppc -arch i386 -pipe -bundle -undefined dynamic_lookup
Using that line you posted and everything worked great!
I need to work out what it is this does. And how this make system works. I could not even recompile without erasing an .o file that was also generated last time I ran make.
Thank you very much Adam! I owe you a cookie!
-
I notice the old line had something in it,
-arch ppc
- would that have made it compatible with PPC macs?
I have an old G4 Mac Mini as well as the Intel Mac. Can I compile on the Intel mac in a manner so that the extension will run on both systems? -
You'll need to add:
"-arch i386 -arch ppc"
to CFLAGS and DLDFLAGS
This will make the Mac compiler build your code for both PowerPC and Intel CPUs.
-
Thanks!
How did you work out that flat namespace is needed for SU Ruby? Since it isn't needed for when you use the normal Ruby?
-
I guess it'd be worth compiling this info into a how-to article...
-
@thomthom said:
I guess it'd be worth compiling this info into a how-to article...
Did you do this? I can't found it...
-
@nikus_knx said:
@thomthom said:
I guess it'd be worth compiling this info into a how-to article...
Did you do this? I can't found it...
I got a Hello World project tutorial over at BitBucket:
https://bitbucket.org/thomthom/sketchup-ruby-c-extensionSCF thread related to the tutorial:
http://forums.sketchucation.com/viewtopic.php?f=180&t=41077
Advertisement