Pregunta

Recently came back to a computer (Mac OS X Lion 10.7) with which I've had repeated environment issues, started a new rails app, and ran

rake db:create

I got this error output (with --trace):

rake aborted!
dlopen(/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle, 9): Library not loaded: /usr/lib/libpq.5.dylib
  Referenced from: /Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle
  Reason: image not found - /Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg_ext.bundle
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/pg-0.15.1/lib/pg.rb:4:in `<top (required)>'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
/Users/<username>/rails/<appname>/config/application.rb:7:in `<top (required)>'
/Users/<username>/rails/<appname>/Rakefile:4:in `require'
/Users/<username>/rails/<appname>/Rakefile:4:in `<top (required)>'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/Users/<username>/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'

config/application.rb:7 refers to:

Bundler.require(:default, Rails.env)

This comes on the heals of a couple environment issues that are, I'm sure, causing the issue, but I don't know how. Basically, I was having issues with homebrew (brew install wget wouldn't work, complaining it was already downloaded, but then saying:

checking for libssl... no
configure: error: --with-ssl=openssl was given, but SSL is not available

So I uninstalled homebrew, uninstalled my shell (fish shell), reinstalled both, and tried to start things from scratch. Probably not a great idea, in retrospect. I seem to have messed things up worse than they already were.

brew doctor seems to think most things are OK, though. The only thing that jumps out at me as possibly related is:

  /Users/sasha/.rvm/bin/pkg-config

(There's another thing brought up -- "/usr/bin occurs before /usr/local/bin", but this only applies to the node, npm, and gcov-4.2 installs, which don't seem relevant to this Rails issue.)

And I think RVM is supposed to have its own pkg-config install, right?

At any rate, OpenSSL is installed and updated by homebrew, and looking good (it shows up in brew list). Also, my XCode Command Line Tools is up to date as well.

I guess my question is if anyone has any idea what's going on? I've tried reordering my path to comply with brew doctor, un/reinstalling lots of things, updating everything, etc, and this just won't go away. Super frustrating, cause I basically can't do anything without rake working. And I think this dylib and openssl issue might be interrelated, so I figured I'd just dump all this data here.

Any ideas? I'd really appreciate help.

Thanks!

EDIT -- This is using Rails 4.0, with the pg gem.

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0.rc1'

# Use postgresql as the database for Active Record
gem 'pg'

if that makes any difference.

UPDATE -- Seems to be related to this problem, which I'm also having. I think rake is not working because of pg, which isn't working because of crpyto/openssl.

¿Fue útil?

Solución

The problem was based on an inexplicably empty libssl.dylib file. There was a backup (libssl.dylib.BAK), and I just overwrote the empty file with it and -- poof -- all the problems went away. No idea how that happened in the first place, but if anyone's having similar problems, I'd look for .BAK files in usr/lib/ and (if there are any) see if the associated files are empty.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top