# Compile ruby 1.9.1 with openssl

**URL:** <https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787>\
**Category:** ruby-talk\
**Created:** [17 March 2010 15:41 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787 "2010-03-17T15:41:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Wu](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@John\_Wu](https://rubytalk.org/u/John_Wu)\
**Post date:** [17 March 2010 15:41 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787/1 "2010-03-17T15:41:45Z")

</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!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Ammar\_Ali](https://avatars.discourse-cdn.com/v4/letter/a/73ab20/32.png) [@Ammar\_Ali](https://rubytalk.org/u/Ammar_Ali)\
**Post date:** [17 March 2010 16:25 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787/2 "2010-03-17T16:25:24Z")

</div>

One way is to build manually:

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

hth,  
ammar

> **···**
>
> On Wed, Mar 17, 2010 at 5:41 PM, John Wu \<j\_wu\_76@yahoo.com\> wrote:
> 
> > 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!  
> > --  
> > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![7stud2](https://avatars.discourse-cdn.com/v4/letter/7/9de053/32.png) [@7stud2](https://rubytalk.org/u/7stud2)\
**Post date:** [30 August 2012 20:50 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787/3 "2012-08-30T20:50:20Z")

</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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![John\_Wu](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@John\_Wu](https://rubytalk.org/u/John_Wu)\
**Post date:** [17 March 2010 16:32 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787/4 "2010-03-17T16:32:54Z")

</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 Ali wrote:

> **···**
>
> > On Wed, Mar 17, 2010 at 5:41 PM, John Wu \<j\_wu\_76@yahoo.com\> wrote:
> > 
> > > How to make it work?
> > > 
> > > Thanks!  
> > > --  
> > > Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
> > 
> > One way is to build manually:
> > 
> > $ cd ext/openssl  
> > $ ruby extconf.rb  
> > $ make  
> > $ make install
> > 
> > hth,  
> > ammar
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Dave\_Walton](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Walton](https://rubytalk.org/u/Dave_Walton)\
**Post date:** [17 March 2010 19:22 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787/5 "2010-03-17T19:22:22Z")

</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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Dave\_Walton](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@Dave\_Walton](https://rubytalk.org/u/Dave_Walton)\
**Post date:** [17 March 2010 20:27 UTC](https://rubytalk.org/t/compile-ruby-1-9-1-with-openssl/57787/6 "2010-03-17T20:27:33Z")

</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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
