1. Michael Granger
  2. ruby-pg
  3. Issues

Issues

Issue #131 invalid

: Library not loaded: @loader_path/../lib/libcrypto.dylib (LoadError)

phillip sellr
created an issue

Hey guys,

first of all many thanks for providing this gem!!!

I am really not sure if this issue is a bug, but since i am not getting any answers on stackoverflow or ruby lang forum. I d like to reach out to you.

I am getting the following error when trying to run a rails console:

{{{

!ruby

rails console /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/pg-0.14.0/lib/pg.rb:4:in require': dlopen(/Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/pg-0.14.0/lib/pg_ext.bundle, 9): Library not loaded: @loader_path/../lib/libcrypto.dylib (LoadError) Referenced from:** /usr/lib/libpq.5.dylib** Reason: Incompatible library version: libpq.5.dylib requires version 1.0.0 or later, but libcrypto.0.9.8.dylib provides version 0.9.8 - /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/pg-0.14.0/lib/pg_ext.bundle from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/pg-0.14.0/lib/pg.rb:4:in<top (required)>' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in require' from /Users/dc/rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:inblock (2 levels) in require' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in each' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:inblock in require' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in each' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:inrequire' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler.rb:119:in require' from /Users/dc/Documents/Aptana Studio 3 Workspace/http/config/application.rb:7:in<top (required)>' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.6/lib/rails/commands.rb:39:in require' from /Users/dc/.rvm/gems/ruby-1.9.3-p194@global/gems/railties-3.2.6/lib/rails/commands.rb:39:in<top (required)>' from script/rails:6:in require' from script/rails:6:in<main>' }}}

I am running on max os 10.6.8 with ruby 1.9.3-p194 postgresql 9.0.8 64 bit, rails 3.2.6, pg 0.14 .

First of all I updated open ssl via macports. So my current version is: {{{

!bash

openssl version OpenSSL 1.0.1c 10 May 2012 }}}

And now it becomes weird to me :

{{{

!bash

otool -L /usr/lib/libpq.5.dylib /usr/lib/libpq.5.dylib: libpq.5.dylib (compatibility version 5.0.0, current version 5.3.0) @loader_path/../lib/libssl.dylib (compatibility version 1.0.0, current version 1.0.0) @loader_path/../lib/libcrypto.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Kerberos.framework/Versions/A/Kerberos (compatibility version 5.0.0, current version 5.0.0) /System/Library/Frameworks/LDAP.framework/Versions/A/LDAP (compatibility version 1.0.0, current version 2.2.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)

}}}

So, shouldn t i believe that I am having lbcrypto 1.0.0?

I look very much forward to hearing from you.

Best, Phil

Comments (7)

  1. Michael Granger repo owner
    • changed status to open

    It looks like your libpq was linked using links relative to the install path, so I'd guess /opt/local/lib since you're using Macports. What does otool -L /usr/lib/libssl.dylib say?

  2. phillip sellr reporter

    Hi Michael, thanks for replying:

    otool -L /usr/lib/libssl.dylib /usr/lib/libssl.dylib: libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) @loader_path/../lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)

    your help is appreciated. best philip

  3. Michael Granger repo owner

    Wow, weird. Do you have your Macports installation in /usr? Or where did your libssl come from? On my 10.7.4 box, I get:

    $ otool -L /usr/lib/libssl.dylib
    /usr/lib/libssl.dylib:
    	/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
    	/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 44.0.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
    

    Anyway, you should be able to change your library's dependent paths using the install_name_tool, like so:

    install_name_tool -change "@loader_path/../lib/libssl.dylib" "/usr/lib/libssl.dylib" /usr/lib/libpq.so.5
    install_name_tool -change "@loader_path/../lib/libcrypto.dylib" "/usr/lib/libcrypto.dylib" /usr/lib/libpq.so.5
    

    I've never done this myself, especially to libraries in /usr, so you should probably keep backups of everything.

  4. phillip sellr reporter

    i dont grasp it.

    find / -iname 'libpq.so.5' doesnt find anything.

    so i tried

    sudo install_name_tool -change "@loader_path/../lib/libssl.dylib" "/usr/lib/libssl.dylib" /usr/lib/libpq.5.dylib
    sudo install_name_tool -change "@loader_path/../lib/libcrypto.dylib" "/usr/lib/libcrypto.dylib" /usr/lib/llibpq.5.dylib 
    

    and nothing changes.. i still get the same error.

    what i am wondering about ist the fact that the gem is still complaining about the wrong libcrypto version but otool look up looks good as i posted before

    otool -L /usr/lib/libssl.dylib
    /usr/lib/libssl.dylib:
    	libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    	@loader_path/../lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
    

    best phil

  5. Michael Granger repo owner

    Yeah, sorry. I mistyped the library name at the end.

    It's not the gem complaining about your library, by the way, it's the dynamic linker (the `dlopen()` call). The gem can't control where you have installed your libraries, and which versions get loaded at runtime -- that's controlled by the linker and the OS. If the linker can't find the correct version of your libraries, then there's a version that's installed somewhere that's getting loaded instead of the ones in /usr/lib. Maybe your RVM installed its own? I'm not sure. Maybe try a 'locate' for libcrypto.0.9.8.dylib?

    Anyway, I'm not sure what else to tell you.

  6. phillip sellr reporter

    (Reply via drop...@gmail.com):

    hey michael,

    yes, indeed, it becomes clear that it is an error with the wrong libs and not the gem.... so, sorry for the inconveniences i was causing... as soon as i find a soultion i ll tell you...

    thanks for supporting me!!! best philip

    2012/7/3 Michael Granger <issues-reply@bitbucket.org>

  7. Log in to comment