Bug #863

Openssl issues with fresh compile on Ubuntu

Added by Brian Takita over 5 years ago. Updated almost 3 years ago.

[ruby-core:20502]
Status:Assigned
Priority:Normal
Assignee:Yukihiro Matsumoto
Category:build
Target version:-
ruby -v:ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

Description

=begin
To reprodule I,
* uncommented openssl in ext/Setup
* ./configure
* make
* make install

Openssl compiled successfully. However when I run irb, I get the following error.

uninitialized constant OpenSSL::SSL::VERIFY_PEER in ssl.rb
=end

mkmf.log (51.9 KB) Chad Woolley, 05/07/2009 01:46 PM

History

#1 Updated by Brian Candler over 5 years ago

=begin
Which Ruby? Which Ubuntu? Which OpenSSL?

I had no problems building ruby-1.9.1 preview1 and preview2 under Ubuntu Hardy with stock openssl (0.9.8g-4ubuntu3.3)

I also didn't have to hack ext/Setup. I just did ./configure --program-suffix=19

$ irb19
irb(main):001:0> require 'openssl'
=> true
irb(main):002:0> OpenSSL::SSL::VERIFY_PEER
=> 1
irb(main):003:0>

Did you remember to install the libssl-dev package first?

What does ext/openssl/mkmf.log show?

=end

#2 Updated by Brian Candler over 5 years ago

=begin
And I've also just got the same successful result with ruby-1.8.7-p72 on the same platform.

./configure --program-suffix=187
make
sudo mv /usr/local/lib/ruby /usr/local/lib/rubyxx
sudo make install

$ irb187
irb(main):001:0> RUBYVERSION
=> "1.8.7"
irb(main):002:0> require 'openssl'
=> true
irb(main):003:0> OpenSSL::SSL::VERIFY
PEER
=> 1

(I'm not sure if there is a clean way to install 1.8.7 alongside 1.8.6. I see ./configure --help shows how to relocate the vendorruby and siteruby directories, but I can't see the same for RUBY_LIB)

=end

#3 Updated by Chad Woolley about 5 years ago

=begin
I got the same thing:

/usr/local/lib/ruby/1.8/openssl/ssl.rb:26: uninitialized constant OpenSSL::SSL::VERIFY_PEER (NameError)
from /usr/local/lib/ruby/1.8/openssl.rb:23:in `require'
from /usr/local/lib/ruby/1.8/openssl.rb:23

Here's my info:

user@user-desktop:~/install/ruby/ruby-1.8.7-p72/ext/openssl$ ruby -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]
user@user-desktop:~/install/ruby/ruby-1.8.7-p72/ext/openssl$ cat /etc/issue
Ubuntu jaunty (development branch) \n \l

user@user-desktop:~/install/ruby/ruby-1.8.7-p72/ext/openssl$ dpkg -l | grep openssl
ii openssl 0.9.8g-15ubuntu3 Secure Socket Layer (SSL) binary and related
ii openssl-blacklist 0.4.2 list of blacklisted OpenSSL RSA keys

I don't have ext/openssl/mkmf.log - I did, but then I did a clean recompile and it is not there anymore.
=end

#4 Updated by Chad Woolley almost 5 years ago

=begin
I just got this again on a new Ubuntu 8.10 install. I'm attaching the mkmf.log this time.
=end

#5 Updated by Nobuyoshi Nakada almost 5 years ago

=begin
Hi,

At Sat, 13 Dec 2008 01:38:09 +0900,
Brian Takita wrote in :

Openssl compiled successfully. However when I run irb, I get the following error.

uninitialized constant OpenSSL::SSL::VERIFY_PEER in ssl.rb

How do you reproduce it?

$ ruby18 -ropenssl -e 'p OpenSSL::SSL::VERIFY_PEER'
1

$ ruby18 -ropenssl.so -e 'p OpenSSL::SSL::VERIFYPEER'
/opt/local/lib/ruby/1.8/openssl/ssl.rb:26: uninitialized constant OpenSSL::SSL::VERIFY
PEER (NameError)
from /opt/local/lib/ruby/1.8/openssl.rb:23:in `require'
from /opt/local/lib/ruby/1.8/openssl.rb:23

If this is the case, why do you require the extension only, but
not the script?

--
Nobu Nakada

=end

#6 Updated by Nobuyoshi Nakada almost 5 years ago

  • Status changed from Open to Feedback
  • ruby -v set to ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

=begin

=end

#7 Updated by Chad Woolley almost 5 years ago

=begin
Your first command fails for me:

$ /usr/local/lib/ruby1.8.7/bin/ruby1.8.7 -ropenssl -e 'p OpenSSL::SSL::VERIFYPEER'
/usr/local/lib/ruby1.8.7/lib/ruby/1.8/openssl/ssl.rb:26: uninitialized constant OpenSSL::SSL::VERIFY
PEER (NameError)
from /usr/local/lib/ruby1.8.7/lib/ruby/1.8/openssl.rb:23:in `require'
from /usr/local/lib/ruby1.8.7/lib/ruby/1.8/openssl.rb:23
=end

#8 Updated by Yukihiro Matsumoto almost 5 years ago

=begin
Hi,

In message "Re: [Bug #863] Openssl issues with fresh compile on Ubuntu"
on Thu, 7 May 2009 16:11:58 +0900, Chad Woolley redmine@ruby-lang.org writes:

|Your first command fails for me:
|
|$ /usr/local/lib/ruby1.8.7/bin/ruby1.8.7 -ropenssl -e 'p OpenSSL::SSL::VERIFYPEER'
|/usr/local/lib/ruby1.8.7/lib/ruby/1.8/openssl/ssl.rb:26: uninitialized constant OpenSSL::SSL::VERIFY
PEER (NameError)
| from /usr/local/lib/ruby1.8.7/lib/ruby/1.8/openssl.rb:23:in `require'
| from /usr/local/lib/ruby1.8.7/lib/ruby/1.8/openssl.rb:23

It's caused by recursive require. There must be TRUE reason behind
why recursive require happens, e.g. RUBYOPT environment variable, but
the following patch stops recursive calls. Could you see if the patch
works?

                        matz.

diff --git a/ext/openssl/ossldigest.c b/ext/openssl/ossldigest.c
index 5bb55af..eac6541 100644
--- a/ext/openssl/ossldigest.c
+++ b/ext/openssl/ossl
digest.c
@@ -233,7 +233,6 @@ ossldigestblocklength(VALUE self)
void
Init
ossldigest()
{
- rb
require("openssl");
rb_require("digest");

#if 0 /* let rdoc know about mOSSL */

=end

#9 Updated by Chad Woolley almost 5 years ago

=begin
Yes! This patch does seem to fix it. Thanks, Matz...
=end

#10 Updated by Yukihiro Matsumoto almost 5 years ago

=begin
Hi,

In message "Re: [Bug #863] Openssl issues with fresh compile on Ubuntu"
on Sun, 10 May 2009 06:38:17 +0900, Chad Woolley redmine@ruby-lang.org writes:

|Yes! This patch does seem to fix it. Thanks, Matz...

Hmm, still something is wrong though. I don't know why openssl.so is
required firsthand. Anyway, I will check in the patch.

                        matz.

=end

#11 Updated by Roger Pack almost 5 years ago

=begin
I would double check it but 1.8.7 from source gives me:

make[1]: Entering directory /free_space/rdp/downloads/ruby_1_8_svn/ext/thread'
gcc -I. -I../.. -I../../. -I../.././ext/thread -D_FILE_OFFSET_BITS=64 -DUSE_MEM_POOLS -fPIC -O2 -g -Wall -Wno-parentheses -fPIC -c thread.c
thread.c: In function ‘unlock_mutex_inner’:
thread.c:485: error: ‘list’ undeclared (first use in this function)
thread.c:485: error: (Each undeclared identifier is reported only once
thread.c:485: error: for each function it appears in.)
make[1]: *** [thread.o] Error 1
make[1]: Leaving directory
/freespace/rdp/downloads/ruby18svn/ext/thread'
make: *** [mkmain.sh] Error 1

:)
-=r

=end

#12 Updated by Marc-Andre Lafortune over 4 years ago

  • Category set to build
  • Status changed from Feedback to Assigned
  • Assignee set to Yukihiro Matsumoto

=begin

=end

Also available in: Atom PDF