libxml-ruby and Windows

Posted by Pieter Bos Tue, 09 Oct 2007 12:41:25 GMT

So, my first post on movesonrails.com! You might not know me, but I am one of the Nedap Healthcare developers. Usually I don't work on Moves or even with ruby on rails, but I needed some functionality...

You might have seen a patch by Bart that allowed ActiveResource to be used with Libxml-ruby, with a dramatic performance increase. The downside was, you can't use libxml with Windows, limiting your applications to mac-os and linux. There was one build of libxml-ruby, which didn't really work, is an older version and missed some rather important files.

But now you can use libxml-ruby in windows! Just unpack this zip into your ruby directory, rename ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\xmlparser.so to xmlparser.s_ and you'll have libxml 0.5.2.0 !

If you'd rather had libxml-ruby 0.3.8.4, you can download this zip instead, or even 0.5.1.0

To achieve this, I spent a morning compiling libxml with mingw. Just forget the following if you just want to use this, but for the sake of future version, this is what i had to do:

1 . install mingw and MSYS in the standard directories (c:\mingw)

2 . download the ruby source and compile, in a different directory than c:\ruby:

./configure --with-prefix=c:/mingw/ruby
    make
    make install

3 . download the zlib, iconv and libxml sources

4 . compile all of them with :

./configure --with-prefix=c:/mingw
    make
    make install

5 . download libxml-ruby

6 . now, the tricky part. You won't have rake (you didn't compile it) so we have to do a trick. Go to your libxml-ruby source directory and type:

    /c/mingw/ruby/bin/ruby ext/xml/extconf.rb
    make
    make install

7 . everything has been compiled. Just copy these files:

    to ruby\bin:
    c:\mingw\bin\iconv-2.dll
    c:\mingw\bin\libxml2-2.dll
    
    to ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\xml:
    C:\MinGW\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\xml\libxml_so.o
    
    to ruby\lib\ruby\site_ruby\1.8\xml
    C:\MinGW\ruby\lib\ruby\site_ruby\1.8\xml\libxml.rb
    

have fun with a 20 times faster XML parser :)

update! versions 0.5.2.0 and 0.3.8.4 also available!

download 0.5.2.0 or 0.3.8.4

Comments

  1. Andre said 36 minutes later:
    Go pieter! :P Welcome, may you generate much traffic :P
  2. Bart ten Brinke said about 2 hours later:
    How many Engineers does it take to compile ruby-libxml under Windows?
  3. Steve M. said 3 days later:
    You are the man. Thanks!
  4. Dirkjan said 3 days later:
    You'll always see, just after creating this, they released libxml-ruby 0.5.2 :P.
  5. Pieter said 6 days later:
    Of course, there will be a new version on here for 0.5.2.0 soon, as well as for the latest stable release :)
  6. CC said 64 days later:
    Amazing..thank you thank you thank you!
  7. Luca said 78 days later:
    Can I find the pre-compiled binaries anywhere? I would like to get a certain ruby webapp to run on my laptop, but not bad enough that I am ready to spend many hours installing, compiling and hacking. If some kind soul was kind enough to want to email those DLLs to me, my email address is: passani at eunet dot no thank you Luca
  8. Luca said 78 days later:
    my bad. I did not see that the pre-compiled packages were available Luca
  9. Bart ten Brinke said 97 days later:
    No problem :).
  10. Zorak said 200 days later:
    Thank you!!!
  11. vsrinu26f@yahoo.com said 384 days later:
    thanks a lot. Please work me out for libxslt too.

(leave url/email »)

   Preview comment