Support for yaml

edited April 2015 in Ruby Scripting

Hi Matthias,

As I am preparing for version 0.24 of your great piece of software, I came across an issue to do with the yaml support in Ruby which (at the moment) only seems to manifest itself in the 0.24-python-eval version for Windows. When I try to require 'yaml', the following error is generated:

C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/yaml.rb:4:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
126: The specified module could not be found.   - C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/x64-mswin64_100/psych.so
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/psych.rb:1:in `<top (required)>'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/yaml.rb:5:in `<top (required)>'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  C:/bin/klayout-0.24-python-eval-win64_python-yaml/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  <main>:in `<main>'

It appears to me that this might have something to do with the Ruby version bundled with KLayout, because in the older Windows and Ubuntu versions 0.23 as well as the Ubuntu build of version r2739 this works fine. All of these versions use Ruby 1.9.x, only klayout-0.24-python-eval-win64 uses Ruby 2.1.3.

On the other hand, a colleague of mine just installed the standalone Ruby interpreter version 2.2.1p85 on his Windows machine and was able to use YAML just fine, so maybe I am completely wrong here about a version dependency...

Long story short, will future versions of KLayout include support for YAML in Ruby?

Thanks,
friendfx

Comments

  • edited April 2015

    Hi friendfx,

    The problem only exists on Windows - on Linux there is no such issue, because KLayout will simply take the system's Ruby installation and installing new packages is a matter of seconds.

    The basic problem on Windows is to build an application both with Qt and Ruby. One is available for MinGW only, the other one for VC++ only ... the bottom line is, I have to build Ruby myself for the target platform (which if Visual Studio 2010 currently). That's already a lot of effort for the basic packages, so I included what is absolutely necessary. Psych is not among that, but given you find a gem supporting Visual Studio 2010, installation should not be a big deal.

    Everything would be easier if there was a common platform. Maybe MinGW will finally evolve into a standard platform for 64bit.

    Maybe that's even possible. If anybody likes to try: it's open source, folks!

    Matthias

  • edited April 2015

    friendfx,

    A hack that may work:

    (Actually yaml is included in my version 0.23.3 so I can't try the method below. (require 'yaml' doesn't generate errors, and some simple test cases work. Also in C:\Program Files\KLayout (64bit)\lib\ruby\1.9.1\ I have both a 'yaml' folder and a 'yaml.rb' as expected.)

    Anyway to get it working, for simple gems and parts of gems (those simple gems that only consist of .rb files and no C libraries or funny stuff), you can just get the 'yaml' folder and 'yaml.rb' and copy it to the directory above, if it doesn't already exist. I tried this with another gem and it worked.

    Where to get yaml folder and yaml.rb? Here is one place: Download this tar: https://sourceforge.net/projects/yaml4r/files/Syck%20%28for%20Ruby%2C%20Python%2C%20PHP%29/0.42/ and then navigate to \syck-0.42\ext\ruby\lib

    Let us know if it works!

    David

Sign In or Register to comment.