luislavena / mysql-gem

MySQL/Ruby Bindings, wrapped as Gem with improved cross-platform support
http://rubyforge.org/projects/mysql-win
Other
53 stars 20 forks source link

Build failing in Mac OS X #18

Closed mcandre closed 11 years ago

mcandre commented 11 years ago

When I try to build mysql-gem in Mac, I get Could not create Makefile due to some reason.

Trace:

$ gem install mysql -v '2.9.1'
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

    /usr/local/Cellar/ruby/1.9.3-p385/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/local/Cellar/ruby/1.9.3-p385/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib

Gem files will remain installed in /usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/Cellar/ruby/1.9.3-p385/lib/ruby/gems/1.9.1/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

System:

$ specs ruby os
Specs:

specs 0.4
https://github.com/mcandre/specs#readme

bundle --version
Bundler version 1.3.5

gem --version
2.0.3

ruby --version
ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-darwin12.2.0]

system_profiler SPSoftwareDataType | grep 'System Version'
      System Version: OS X 10.8.3 (12D78)
luislavena commented 11 years ago

@mcandre do you have mysql client library installed in your system? seems mkmf can't find it:

checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no

Either you install it with brew or macports, whatever you're using to install dependencies.

mcandre commented 11 years ago

@luislavena Good point. Which Homebrew package would that be?

luislavena commented 11 years ago

@mcandre no idea, I'm not a homebrew user, perhaps mysql-connector-c formula?

mcandre commented 11 years ago

@luislavena brew install mysql-connector-c fixes it on my machine!