Compile ruby 1.9.1 with openssl

Hi

I want to istall ruby 1.9.1-p378 with openssl support. Here is the
command I used

./configure --with-openssl-dir=/usr/local/ssl

But it returns something like “unrecognized --with-openssl-dir”

How to make it work?

Thanks!

On Wed, Mar 17, 2010 at 5:41 PM, John Wu [email protected] wrote:

How to make it work?

Thanks!

Posted via http://www.ruby-forum.com/.

One way is to build manually:

$ cd ext/openssl
$ ruby extconf.rb
$ make
$ make install

hth,
ammar

I got

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff… ===
checking for t_open() in -lnsl… no
checking for socket() in -lsocket… no
checking for assert.h… yes
=== Checking for required stuff… ===
checking for openssl/ssl.h… yes
checking for OpenSSL_add_all_digests() in -lcrypto… no
checking for OpenSSL_add_all_digests() in -llibeay32… no
=== Checking for required stuff failed. ===
Makefile wasn’t created. Fix the errors above.

what am I missing here?

Ammar A. wrote:

On Wed, Mar 17, 2010 at 5:41 PM, John Wu [email protected] wrote:

How to make it work?

Thanks!

Posted via http://www.ruby-forum.com/.

One way is to build manually:

$ cd ext/openssl
$ ruby extconf.rb
$ make
$ make install

hth,
ammar

John Wu wrote:

I got

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff… ===
checking for t_open() in -lnsl… no
checking for socket() in -lsocket… no
checking for assert.h… yes
=== Checking for required stuff… ===
checking for openssl/ssl.h… yes
checking for OpenSSL_add_all_digests() in -lcrypto… no
checking for OpenSSL_add_all_digests() in -llibeay32… no
=== Checking for required stuff failed. ===
Makefile wasn’t created. Fix the errors above.

what am I missing here?

I believe you have to install openssl on your box first.

As a matter of fact, I had the same problem. I installed openssl.

I then went back to following ammar’s instructions above, but when I
‘make’ it barfs.
ruby extconf.rb looks like it produces good results.
but make results in:
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld:
/usr/local/lib/libssl.a(s2_meth.o): relocation R_X86_64_32 against `a
local symbol’ can not be used when making a shared object; recompile
with -fPIC
/usr/local/lib/libssl.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [openssl.so] Error 1

I suspected this meant I needed to rebuild my openssl with -fPIC, which
I did, but when I came back to do the make again, it only slightly
changed the error:
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld:
/usr/local/lib/libcrypto.a(x86_64cpuid.o): relocation R_X86_64_PC32
against symbol `OPENSSL_cpuid_setup’ can not be used when making a
shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld:
final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [openssl.so] Error 1

Has anyone else seen this problem? Any suggestion as to how to proceed?

Thanks,

Dave

I wrote:

/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld:
/usr/local/lib/libcrypto.a(x86_64cpuid.o): relocation R_X86_64_PC32
against symbol `OPENSSL_cpuid_setup’ can not be used when making a
shared object; recompile with -fPIC
/usr/lib64/gcc/x86_64-suse-linux/4.3/…/…/…/…/x86_64-suse-linux/bin/ld:
final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [openssl.so] Error 1

Has anyone else seen this problem? Any suggestion as to how to proceed?

Thanks,

Dave

I rebuilt openssl with the following configure, and it fixed my problem:
./config --prefix=/usr/local --openssldir=/usr/local/openssl shared

Dave

I came across this same issue. Just to add. If you’re running Ubuntu,
the standard openssl package won’t contain what you need, you will want
to:
$ sudo apt-get install libssl-dev