The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Ruby, OpenSSL and Zlib

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Daniel Berger

Posts: 1383
Nickname: djberg96
Registered: Sep, 2004

Daniel Berger is a Ruby Programmer who also dabbles in C and Perl
Ruby, OpenSSL and Zlib Posted: Oct 2, 2008 5:20 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Daniel Berger.
Original Post: Ruby, OpenSSL and Zlib
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Daniel Berger
Latest Posts From Testing 1,2,3...

Advertisement
Building Ruby on Windows manually with VC++ is pretty straightforward. The downside is that two libraries in particular, OpenSSL and Zlib, have always been a PITA to build yourself. Since Rubygems needs Zlib, and Rails needs OpenSSL, this has always been problematic.

The zlib problem has been partially solved by Zliby, a pure Ruby implementation of zlib. You can use zliby.rb (renamed to zlib.rb) for installing gems. The downside is that the GzipWriter class isn't implemented yet, so you can't yet build gems. Still, that's not an issue if don't care about building gems locally.

Building OpenSSL is trickier, but with 0.9.8i it's certainly gotten easier. They've added a Perl configure script to help Windows users out. So long as you have Perl installed (which you can grab from ActiveState) you can install OpenSSL. This is how I did it:
perl Configure VC-WIN32 --prefix=c:/usr/local/openssl
ms\do_nasm
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak install

We're not quite done, though. There's a macro bug in the openssl x509.h file you'll need to fix first. Here's the diff:
--- x509.orig   Thu Oct 02 11:30:10 2008
+++ x509.h      Thu Oct 02 11:47:05 2008
@@ -116,6 +116,7 @@
 /* Under Win32 these are defined in wincrypt.h */  #undef X509_NAME
#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS
 #endif

 #define X509_FILETYPE_PEM      1

With that in place, you can now build the Ruby interface to openssl like so:
ruby extconf.rb --with-openssl-dir=c:/usr/local/openssl
nmake
nmake install

When you try to use the Ruby openssl bindings you might get this error:
"The ordinal 284 could not be located in the dynamic link library SSLEAY32.DLL"

The problem is that Ruby is picking up an ssleay32.dll file from another application (several apps tend to bundle it, e.g. PostgreSQL). You'll want to make sure you're using the one you just built by setting your path properly:
set PATH=C:\usr\local\openssl\bin;%PATH%

And you should be good to go.

Read: Ruby, OpenSSL and Zlib

Topic: Three Amendments Previous Topic   Next Topic Topic: Testing Dynamic Web Applications

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use