# Compile ruby 1.9.1 with openssl

**URL:** <https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294>\
**Category:** Ruby\
**Created:** [March 17, 2010, 4:41pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294 "2010-03-17T16:41:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 17, 2010, 4:41pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294/1 "2010-03-17T16:41:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 17, 2010, 5:25pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294/2 "2010-03-17T17:25:56Z")

</div>

On Wed, Mar 17, 2010 at 5:41 PM, John Wu [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How to make it work?
> 
> ## Thanks!
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

One way is to build manually:

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

hth,  
ammar

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 17, 2010, 5:32pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294/3 "2010-03-17T17:32:48Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > How to make it work?
> > 
> > ## Thanks!
> > 
> > Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> One way is to build manually:
> 
> $ cd ext/openssl  
> $ ruby extconf.rb  
> $ make  
> $ make install
> 
> hth,  
> ammar

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 17, 2010, 8:22pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294/4 "2010-03-17T20:22:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [March 17, 2010, 9:27pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294/5 "2010-03-17T21:27:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![princenamor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/c0e974/32.png) [@princenamor](https://www.ruby-forum.com/u/princenamor)\
**Post date:** [August 30, 2012, 10:50pm UTC](https://www.ruby-forum.com/t/compile-ruby-1-9-1-with-openssl/185294/6 "2012-08-30T22:50:17Z")

</div>

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
