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