mysql2: dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Problem
I was able to compile mysql2 on my Mac but I’m getting that error requiring it.
$ gem install mysql2 -v0.3.21 -- --with-mysql-include=$(brew --prefix mysql-connector-c)/include --with-mysql-lib=$(brew --prefix mysql-connector-c)/lib/ --with-mysql-config=$(brew --prefix mysql-connector-c)/bin/mysql_config
Building native extensions with: '--with-mysql-include=/usr/local/opt/mysql-connector-c/include --with-mysql-lib=/usr/local/opt/mysql-connector-c/lib/ --with-mysql-config=/usr/local/opt/mysql-connector-c/bin/mysql_config'
This could take a while...
Successfully installed mysql2-0.3.21
Parsing documentation for mysql2-0.3.21
Installing ri documentation for mysql2-0.3.21
Done installing documentation for mysql2 after 0 seconds
1 gem installed
$ ruby -e 'require "mysql2"'
dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info
Referenced from: /Users/tapajos/.gem/ruby/2.3.1/gems/mysql2-0.3.21/lib/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_get_client_info
Referenced from: /Users/tapajos/.gem/ruby/2.3.1/gems/mysql2-0.3.21/lib/mysql2/mysql2.bundle
Expected in: flat namespace
Abort trap: 6
System details
OS X: 10.12.3 XCode: 8.3 mysql-connector-c: 6.1.9 (installed using homebrew) gem environment:
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.5.1
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/tapajos/.gem/ruby/2.3.1
- USER INSTALLATION DIRECTORY: /Users/tapajos/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/tapajos/.rubies/ruby-2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/tapajos/.gem/ruby/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/tapajos/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/tapajos/.rubies/ruby-2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-16
- GEM PATHS:
- /Users/tapajos/.gem/ruby/2.3.1
- /Users/tapajos/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/tapajos/.gem/ruby/2.3.1/bin
- /Users/tapajos/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bin
- /Users/tapajos/.rubies/ruby-2.3.1/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/Cellar/mysql55/5.5.49/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/tapajos/dotfiles/bin
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28
Use just one --with-mysql-xxx option. Use
--with-mysql-config
, that allows the mysql_config tool to report the best information for compiling and linking. https://github.com/brianmario/mysql2#configuration-optionsHi @sodabrew,
Using only
---with-mysql-config
it fails to compile the gem.Using
--with-mysql-dir
it compiles without any error or warning but keeps failing on the require.Also tried with
--with-mysql-config
and--with-mysql-rpath
.