简体   繁体   English

导轨服务器错误? (导轨 3)

[英]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 dyld:惰性符号绑定失败:找不到符号:_mysql_get_client_info 引用自:/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 dyld:找不到符号:_mysql_get_client_info 引用自:/Library/Ruby/Gems/1.8/gems/mysql2-0.3.2/lib/mysql2/mysql2.bundle
Expected in: flat namespace预期在:平面命名空间

Trace/BPT trap跟踪/BPT 陷阱

Updated MySQL again from installer (say, mysql-5.5.10-osx10.6-x86_64 ).再次从安装程序更新 MySQL(例如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然后 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把它放在你的.profile(或.bashrc)中并输入这个命令

my_term> source.profile my_term> source.profile

replace '/usr/local/mysql/lib/' by where you MySQL client is installed将“/usr/local/mysql/lib/”替换为 MySQL 客户端的安装位置

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 ).我也遇到了这个问题,我在这里或其他问题中找到的任何建议都没有让我到任何地方,但是以 root 身份运行(使用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.我想当以 root 身份运行时,它使用 mysql 库的正确路径,但是按照此处链接之一中的说明使用install_name_tool更改它也不起作用。 As long as I don't find the issue, I need to start my rails app with sudo.只要我没有发现问题,我就需要使用 sudo 启动我的 rails 应用程序。

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 http://rorguide.blogspot.com/2011/07/getting-error-library-not-loaded.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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