sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    C Extension on OSX crashes SU

    Scheduled Pinned Locked Moved Developers' Forum
    18 Posts 5 Posters 2.9k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      driven
      last edited by

      hi Thom,

      I can't even get it working in IRB with only the zip bundle, but if you want to PM me some sort of mac tests I'll run them later on.

      did you download the latest Xcode update? the one on the instal disc is out dated...

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        @driven said:

        I can't even get it working in IRB with only the zip bundle, but if you want to PM me some sort of mac tests I'll run them later on.

        No? Errors?

        @driven said:

        did you download the latest Xcode update? the one on the instal disc is out dated...

        I just used the one on the disk...

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by

          @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

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @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?

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              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

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                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...

                Thomas Thomassen — SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by

                  @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

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    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.

                    Thomas Thomassen — SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      macumber
                      last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • AdamBA Offline
                        AdamB
                        last edited by

                        @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

                        Developer of LightUp Click for website

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          👍

                          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!

                          Thomas Thomassen — SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • thomthomT Offline
                            thomthom
                            last edited by

                            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?

                            Thomas Thomassen — SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • AdamBA Offline
                              AdamB
                              last edited by

                              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.

                              Developer of LightUp Click for website

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                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?

                                Thomas Thomassen — SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • thomthomT Offline
                                  thomthom
                                  last edited by

                                  I guess it'd be worth compiling this info into a how-to article...

                                  Thomas Thomassen — SketchUp Monkey & Coding addict
                                  List of my plugins and link to the CookieWare fund

                                  1 Reply Last reply Reply Quote 0
                                  • N Offline
                                    nikus_knx
                                    last edited by

                                    @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...

                                    1 Reply Last reply Reply Quote 0
                                    • thomthomT Offline
                                      thomthom
                                      last edited by

                                      @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-extension

                                      SCF thread related to the tutorial:
                                      http://forums.sketchucation.com/viewtopic.php?f=180&t=41077

                                      Thomas Thomassen — SketchUp Monkey & Coding addict
                                      List of my plugins and link to the CookieWare fund

                                      1 Reply Last reply Reply Quote 0
                                      • 1 / 1
                                      • First post
                                        Last post
                                      Buy SketchPlus
                                      Buy SUbD
                                      Buy WrapR
                                      Buy eBook
                                      Buy Modelur
                                      Buy Vertex Tools
                                      Buy SketchCuisine
                                      Buy FormFonts

                                      Advertisement