简体   繁体   English

Ruby Gem Mysql Mac 10.6.8

[英]Ruby Gem Mysql Mac 10.6.8

I would like to create a MySQL database for an open source app I've forked on Github: https://lobste.rs . 我想为我在Github上创建的一个开源应用程序创建一个MySQL数据库: https : //lobste.rs It is a Rails 4 codebase and uses a SQL backend for the database. 它是Rails 4的代码库,并使用SQL后端作为数据库。 I've follow all the steps but: 我已遵循所有步骤,但:

When I $ rake db:schema:load 当我$ rake db:schema:load

The answer is 答案是

Could not find mysql2-0.3.14 in any of the sources
Run `bundle install` to install missing gems.

I run bundle install but 我运行捆绑安装,但是

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

    /User/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... *** 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
    --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=/User/.rvm/rubies/ruby-1.9.3-p429/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
/User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:870:in `block in find_library'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:866:in `find_library'
    from extconf.rb:39:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /User/.rvm/gems/ruby-1.9.3-p429/gems/mysql-2.9.1 for inspection.
Results logged to /User/.rvm/gems/ruby-1.9.3-p429/extensions/x86_64-darwin-10/1.9.1/mysql-2.9.1/gem_make.out

I believe I have the rights Xcode version for my Mac 10.6.8 Lion. 我相信我拥有Mac 10.6.8 Lion的Xcode版本的权利。

Does anybody know how cain I install the ruby gem of mysql from the terminal? 有人知道如何从终端安装mysql的ruby gem吗? Thanks! 谢谢!

The mkmf.log is: mkmf.log是:

"gcc-4.2 -o conftest -I/User/.rvm/rubies/ruby-1.9.3-p429/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/User/.rvm/rubies/ruby-1.9.3-p429/include/ruby-1.9.1/ruby/backward -I/User/.rvm/rubies/ruby-1.9.3-p429/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include  -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe conftest.c  -L. -L/Users/miguelcarvajal/.rvm/rubies/ruby-1.9.3-p429/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib      -lruby.1.9.1  -lpthread -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

要回答有关从终端安装mysql gem的问题,请尝试运行:

gem install mysql2

Problem solved. 问题解决了。 I did have to re-install the appropriate xCode version and then the problem was fixed. 我确实必须重新安装适当的xCode版本,然后问题才得以解决。 No I have mysql2 up and running correctly. 不,我已经安装了mysql2并正常运行。

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

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