Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation still fails on MacPorts mysql56 #589

Closed
ain opened this issue Mar 3, 2015 · 10 comments
Closed

Installation still fails on MacPorts mysql56 #589

ain opened this issue Mar 3, 2015 · 10 comments

Comments

@ain
Copy link

ain commented Mar 3, 2015

Despite of #577, it fails to pick up /opt/local/lib/mysql56:

/Users/ain/.rvm/gems/ruby-2.2.1/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2.rb:31:in `require': dlopen(/Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2/mysql2.bundle
    from /Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2.rb:31:in `<top (required)>'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler/runtime.rb:76:in `require'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler/runtime.rb:72:in `each'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler/runtime.rb:61:in `each'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler/runtime.rb:61:in `require'
    from /Users/ain/.rvm/gems/ruby-2.2.1@global/gems/bundler-1.8.3/lib/bundler.rb:134:in `require'
    from /Users/ain/Documents/projects/lindt-goldhase/config/application.rb:7:in `<top (required)>'
    from /Users/ain/.rvm/gems/ruby-2.2.1/gems/railties-3.2.21/lib/rails/commands.rb:53:in `require'
    from /Users/ain/.rvm/gems/ruby-2.2.1/gems/railties-3.2.21/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /Users/ain/.rvm/gems/ruby-2.2.1/gems/railties-3.2.21/lib/rails/commands.rb:50:in `tap'
    from /Users/ain/.rvm/gems/ruby-2.2.1/gems/railties-3.2.21/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

I think the problem we have here is that I also have /usr/local/mysql-* but with the server that has no source libs in it.

@sodabrew
Copy link
Collaborator

sodabrew commented Mar 3, 2015

Oh! The installation didn't fail, the runtime linker is failing. What's the rpath on your mysql2.bundle? For example, here's my output:

$ otool -L lib/mysql2/mysql2.bundle
lib/mysql2/mysql2.bundle:
    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib (compatibility version 2.0.0, current version 2.0.0)
    /opt/local/lib/mysql56/mysql/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

@ain
Copy link
Author

ain commented Mar 3, 2015

$ otool -L /Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2/mysql2.bundle 
/Users/ain/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.18/lib/mysql2/mysql2.bundle:
    /Users/ain/.rvm/rubies/ruby-2.2.1/lib/libruby.2.2.0.dylib (compatibility version 2.2.0, current version 2.2.0)
    libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
    /opt/local/lib/libgmp.10.dylib (compatibility version 13.0.0, current version 13.0.0)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)

@sodabrew
Copy link
Collaborator

sodabrew commented Mar 6, 2015

Sorry for the slow reply. I haven't been able to reproduce this, but a similarly weird issue appeared here: #556 (comment) I wonder if there's some odd combo of compilers or flags on OS X that conspire together?

It is possible to use otool to modify the bundle and add a path to libmysqlclient.18.dylib, but that's just a band-aid on the problem.

What is the source of your MySQL? e.g. Macports, Homebrew, Oracle installer, etc.?

@ain
Copy link
Author

ain commented Mar 6, 2015

No probs @sodabrew. The context:

  • MySQL server installed from MySQL binaries from the website so the installation sits symlinked at /usr/local/mysql -> mysql-5.6.20-osx10.7-x86_64
  • MySQL dev libs installed by MacPorts, sitting at /opt/local/lib/mysql56. What I just realised, is that there's also an older version at /opt/local/lib/mysql55, but it shouldn't actually interfere.

@sodabrew
Copy link
Collaborator

@tgalery
Copy link

tgalery commented Aug 2, 2016

@sodabrew I'm having a similar problem. I'm trying to use a plugin from chef dk that uses the mysql2 gem. I'm using osx el captain

After installing the gem and plugin, I get the following

Ignoring mysql2-0.4.4 because its extensions are not built.  Try: gem pristine mysql2 --version 0.4.4
/opt/chefdk/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mysql2 (LoadError)

I tried to build the lib using the --with-mysql-dir and so far no good, any ideas of what I might be doing wrong ?

@inspire22
Copy link

Did you try installing the "connector C"? I'm using mariadb and homebrew and had a similar problem. Passing in the mysql directory would get it to compile but then it'd fault when I tried to load it.

Installing the "connector c" solved it for me... ( brew install mariadb-connector-c ), then I was able to install directly without passing in a mysql-dir and it seems to be working.

Or maybe this isn't related at all haha :)

@sodabrew
Copy link
Collaborator

I feel badly that this issue from two years ago may not have had a satisfactory resolution? Is anybody here still stuck at this time, or have other factors helped to resolve the original problem? I hope to be able to close the ticket with a positive resolution.

@ain
Copy link
Author

ain commented Apr 26, 2017

I'm running my stack on Docker now as do many others. Therefore the issue is pretty much obsolete and shouldn't really be pursued much further.

@robertlabrie
Copy link

Old thread, maybe Google got you here. For me the issue was permissions on mysql2.so. Ruby tells you the dependencies are not installed, when in fact, the process couldn't read them because they're chmod 640. Don't have this problem in Docker because everything runs as "root".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants