简体   繁体   中英

rails server error ? (rails 3)

/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2.rb:8
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
    from /Users/imran/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6

Does anyone know how i can fix this?? Thanks in advance;-)

now i'm getting this?

dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Expected in: flat namespace

dyld: Symbol not found: _mysql_get_client_info Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Expected in: flat namespace

Trace/BPT trap

Updated MySQL again from installer (say, mysql-5.5.10-osx10.6-x86_64 ).

Then MySQL2 gem: $ sudo gem install mysql2 -- --with-mysql-config=/usr/local/mysql-5.5.10-osx10.6-x86_64/bin/mysql_config

It worked for me.

Try this:

export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"

Put this in your.profile (or.bashrc) and type this command

my_term> source.profile

replace '/usr/local/mysql/lib/' by where you MySQL client is installed

I also had this problem and any suggestions I found here or in other questions didn't get me anywhere, but running as root did (with sudo rails s ). I guess that when running as root, it uses the right path to the mysql library, but changing it with install_name_tool as described in one of the links here doesn't work, too. As long as I don't find the issue, I need to start my rails app with sudo.

For permanent fix, try to create a soft link by command -

sudo ln -s /usr/local/mysql/lib/libmysqlclient.16.dylib /usr/lib/libmysqlclient.16.dylib

http://rorguide.blogspot.com/2011/07/getting-error-library-not-loaded.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM