We were having mysterious seg faults with some long-running Rails tasks on our server, so I thought it might time for some software updates. Nothing too radical just Ruby 1.8.5 -> 1.8.6 and Rails 1.2.3 -> 1.2.6. In the process I discovered that a new version of RubyGems was available, so I thought it might be good to upgrade it at the same time, Gem 0.9.4 -> 1.0.1. The Ruby, Gem, and Rails upgrades went fine, but ultimately the Gem upgrade proved to be a bad idea. The upgrade seemed to have lost all my installed Gems, except for the just upgraded Rails and its dependencies. Some minor dismay, but no big deal I thought, I've got a list of the Gems we needed, so I'll end up updating all the Gems at the same time too. Everything seemed to be going OK, until I discovered that the ruby-openid Gem had a dependency on a method from the older versions, namely Kernel#require_gem was removed and replaced with just Kernel#gem. As far as I can tell this was nothing but a name change which begs the question why do this when it is almost guaranteed to break a bunch of other code. Anyway, I had to revert back to a previous version of RubyGems, 0.9.5, which seems to have fixed the problem. All in all a rather nerve wracking undertaking.
As I type this, a task which was previously throwing seg faults has been running for about 30 minutes without error, so my hope is that all this trouble has at least solved that problem.
Saturday, March 15, 2008
Thursday, March 13, 2008
Compiling ruby-xslt on Windows
After much head bashing I've gotten the ruby-xslt gem to compile on Windows. Roughly, here are the steps I went through:
- Make sure libxml-ruby is working. See my previous blog post on installing it for Windows.
- 'gem install ruby-xslt' this downloads the gem and attempts to compile and install. It fails, but it leaves all the files in your ruby\lib\...\gems folder. I got 0.9.5 version of ruby-xslt
- Download the latest versions of libxml2, libxslt, and libiconv with all the binaries, includes, and libs for Windows. I copied the *.dll files into my windows\system32 folder.
- Now the trial and error began. I had to tweak the Makefile to get the include and lib paths correct for my system.
- I was using the MS Visual Studio (VS) tools NMAKE and CL. A major issue was the version of these tools. I started off with the VS 2005, but discovered that it links to a different version of the C runtime that is not compatible with the dependent DLLs, like libxml2.dll, etc. I had to install VS 6.0, and this seemed to solve the problem.
- Next I needed to make some modifications to the xslt_lib.c file. It seemed to be using some non-ANSI C constructs that MS C compiler didn't like. These seemed to be C99 compliant stuff like dynamically allocated arrays, but apparently VS does not support C99.
- Finally, got a compiled and linked version that works. Since by this time I didn't feel like messing with gem install scripts, I just manually moved all the files into their normal ruby directories.
- xslt_lib.so => \ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\xml folder
- xslt.rb => \ruby\lib\ruby\site_ruby\1.8\xml
Subscribe to:
Posts (Atom)