Bug #6379

inconsistent configuration of core extensions linking against libssl and libcrypto (ext/openssl, ext/digest/*)

Added by Stefan Kaes almost 2 years ago. Updated almost 2 years ago.

[ruby-core:44755]
Status:Closed
Priority:Normal
Assignee:-
Category:build
Target version:1.9.3
ruby -v:ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0] Backport:

Description

ext/openssl/extconf.rb was change some time ago to prefer compile settings via a pkconfig("openssl") directive.

See https://github.com/ruby/ruby/commit/f6b49243eb0c21bea1c4198cdd52a549e6ead075

However, ext/digest/{md5,rmd160,sha1,sha2}/extconf.rb have not been changed.

This can result in multiple versions of libcrypto and libssl being linked into ruby, which in turn can lead to strange behavior/crashes.

For example, on OS X, with macports installed and its pkg-config binary in the search path, you will get the following list of libraries:

/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.44.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl (compatibility version 8.5.0, current version 8.5.7)
/System/Library/Frameworks/Tk.framework/Versions/8.5/Tk (compatibility version 8.5.0, current version 8.5.7)
/opt/local/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libffi.5.dylib (compatibility version 6.0.0, current version 6.10.0)
/opt/local/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/usr/lib/libutil.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/local/lib/libreadline.6.2.dylib (compatibility version 6.0.0, current version 6.2.0)
/usr/local/lib/libyaml-0.2.dylib (compatibility version 3.0.0, current version 3.2.0)

This happens with a plain ./configure (no arguments given).

If instead you pass --with-opt-dir=/opt/local to ./configure, you get a consistent set of libraries.

I think this is problematic, because it means rvm and ruby-build are broken out of the box for users of MacPorts.

There are two ways to fix this:

1) revert the commit, as it it seems to cause more problems than it fixes
2) add corresponding pkgconfig directives to all the mentioned extconf.rb files

I'm for reverting the patch.

What do you think?

PS:

I used
find . -name '*.bundle' -exec otool -L {} \; | sort | uniq | grep -v ':'
to create the list.

Associated revisions

Revision 35504
Added by Nobuyoshi Nakada almost 2 years ago

  • ext/digest/*/extconf.rb: use pkg_config to use same library with openssl. [Bug #6379]
  • ext/openssl/deprecation.rb: extract check for broken Apple OpenSSL.

History

#1 Updated by Nobuyoshi Nakada almost 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r35504.
Stefan, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/digest/*/extconf.rb: use pkg_config to use same library with openssl. [Bug #6379]
  • ext/openssl/deprecation.rb: extract check for broken Apple OpenSSL.

Also available in: Atom PDF