• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Support for Gems with Native Extensions?

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 3 Posters 231 Views 3 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.
  • T Offline
    TwoByteHero
    last edited by 31 Mar 2014, 23:22

    Hi all,

    Please forgive my newbieness/ignorance, but are there any plans or is anyone working on support for Gems that require Native Extensions?

    I know the complexities (I've been investigating for kicks this weekend) but this would be a huge boon for Ruby developers. I was specifically aiming to install nokogiri and have been experimenting over the weekend with little success.

    Additionally there appear to be quite a few files missing from the Std-lib. mkmf.rb and the irb files are notable. I can guess why as to the irb files weren't included but I'm curious about the rest of them. Can anyone shed some insight here for me?

    1 Reply Last reply Reply Quote 0
    • T Offline
      tt_su
      last edited by 1 Apr 2014, 11:25

      Some part of the Ruby Standard library would crash SketchUp because it made adduption about Ruby being run as a Console app instead of being embedded as it is in SketchUp. So we removed those modules to avoid inadvertent crashes.

      "Native Extensions" you mean Ruby C Extensions?
      We have example Visual Studio and Xcode project for this on GitHub:
      https://github.com/SketchUp/ruby-c-extension-examples

      What challenges did you have with Nokogiri?

      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by 1 Apr 2014, 12:58

        On Mac OS X, even with XCode and command line developer tools installed, the SU installation of Ruby is not set up to enable compiling and installation of most C-library Gems. For example, one Gem I attempted assumed that there was an executable Ruby interpreter in the SU Ruby Framework where the Gem library lives (there is not - only the dynamic library loaded by SU). Fixing this requires loading a 32-bit Ruby compatible with SU, since the native installation is 64-bit. But even then the generated Makefile and other scripts fail due to problems with configuration. For example, Ruby was launched with an illegal command line option to one of the install scripts. In the end I hand-edited things and got the Gem to compile and install, only to discover as TT points out that SU's Ruby intentionally omits certain standard library components that were found to crash SU.

        Bottom line: with enough determination you can build a compiled-C Gem, but don't be surprised if libraries it wants are missing or if it BugSplats SU!

        Steve

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

        Advertisement