# Compiling Ruby on OSX, OpenSSL error and possible fix

**URL:** <https://www.ruby-forum.com/t/compiling-ruby-on-osx-openssl-error-and-possible-fix/158293>\
**Category:** Ruby\
**Created:** [January 21, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/compiling-ruby-on-osx-openssl-error-and-possible-fix/158293 "2009-01-21T19:54:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@juan](https://www.ruby-forum.com/u/juan)\
**Post date:** [January 21, 2009, 7:54pm UTC](https://www.ruby-forum.com/t/compiling-ruby-on-osx-openssl-error-and-possible-fix/158293/1 "2009-01-21T19:54:01Z")

</div>

I got this error compiling Ruby (ruby-1.8.6-p287) on OSX (10.5.6, Darwin  
Kernel Version 9.6.0):

openssl\_missing.h:123: error: conflicting types for ‘BN\_rand\_range’  
/usr/local/include/openssl/bn.h:411: error: previous declaration of  
‘BN\_rand\_range’ was here  
openssl\_missing.h:124: error: conflicting types for  
‘BN\_pseudo\_rand\_range’  
/usr/local/include/openssl/bn.h:412: error: previous declaration of  
‘BN\_pseudo\_rand\_range’ was here  
make[1]: \*\*\* [openssl\_missing.o] Error 1

These functions were declared in two different files. Once in  
include/openssl/bn.h and again in  
ruby-1.8.6-p287/ext/openssl/openssl\_missing.h

I solved it commenting these two lines in include/openssl/bn.h[411,412].

---

<div class="post-metadata">

**Author:** ![juan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@juan](https://www.ruby-forum.com/u/juan)\
**Post date:** [January 21, 2009, 8:34pm UTC](https://www.ruby-forum.com/t/compiling-ruby-on-osx-openssl-error-and-possible-fix/158293/2 "2009-01-21T20:34:45Z")

</div>

Late, running Gem I got this error:

$ gem update  
dyld: NSLinkModule() error  
dyld: Symbol not found: \_EVP\_CIPHER\_CTX\_block\_size  
Referenced from:  
/usr/local/lib/ruby/1.8/i686-darwin9.6.0/openssl.bundle  
Expected in: flat namespace

Trace/BPT trap

Removing openssl port installed previously with macports all work fine!

You forgive for this monologue.  
Juan M…

Juan M. wrote:

> I got this error compiling Ruby (ruby-1.8.6-p287) on OSX (10.5.6, Darwin  
> Kernel Version 9.6.0):
> 
> openssl\_missing.h:123: error: conflicting types for ‘BN\_rand\_range’  
> /usr/local/include/openssl/bn.h:411: error: previous declaration of  
> ‘BN\_rand\_range’ was here  
> openssl\_missing.h:124: error: conflicting types for  
> ‘BN\_pseudo\_rand\_range’  
> /usr/local/include/openssl/bn.h:412: error: previous declaration of  
> ‘BN\_pseudo\_rand\_range’ was here  
> make[1]: \*\*\* [openssl\_missing.o] Error 1
> 
> These functions were declared in two different files. Once in  
> include/openssl/bn.h and again in  
> ruby-1.8.6-p287/ext/openssl/openssl\_missing.h
> 
> I solved it commenting these two lines in include/openssl/bn.h[411,412].

---

<div class="post-metadata">

**Author:** ![juan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@juan](https://www.ruby-forum.com/u/juan)\
**Post date:** [October 23, 2010, 6:45am UTC](https://www.ruby-forum.com/t/compiling-ruby-on-osx-openssl-error-and-possible-fix/158293/3 "2010-10-23T06:45:32Z")

</div>

I got the same error installing Ruby EE 1.8.6 and solved it by moving  
openssl out of my include path.

$ sudo mv /usr/include/openssl/ ~/

🙂
