在jruby上安装mysql的许多错误 [英] many errors installing mysql on jruby

查看:66
本文介绍了在jruby上安装mysql的许多错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装mysql gem以便在Rails上使用,使用jruby,无法弄清楚这一点...感谢您的帮助!

I'm trying to get mysql gem installed for use on rails, using jruby, can't figure this out...any help is appreciated!

$ sudo gem install mysql2

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

        /Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
checking for rb_thread_blocking_region()... checking for rb_wait_for_single_fd()... no
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make
cc -I. -I. -I/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -I/usr/local/mysql/include  -g -Os -arch x86_64 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall -funroll-loops  -arch x86_64 -c client.c
cc -I. -I. -I/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -I/usr/local/mysql/include  -g -Os -arch x86_64 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall -funroll-loops  -arch x86_64 -c mysql2_ext.c
cc -I. -I. -I/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby/lib/native/include/ruby -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE        -I/usr/local/mysql/include  -g -Os -arch x86_64 -fno-common   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT  -DDONT_DECLARE_CXA_PURE_VIRTUAL -fPIC -DTARGET_RT_MAC_CFM=0  -fno-omit-frame-pointer -fno-strict-aliasing  -fexceptions   -Wall -funroll-loops  -arch x86_64 -c result.c
cc -dynamic -bundle -undefined dynamic_lookup  -o mysql2.bundle client.o mysql2_ext.o result.o -L"." -L"/Users/masedesign/Work/repos/code/conf/vms/ruby/jruby-1.6.5/lib" -bundle -framework JavaVM -Wl,-syslibroot, -mmacosx-version-min=10.4  -Wl,-rpath,/usr/local/mysql/lib  -arch x86_64  -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm     -lmygcc   
ld: library not found for -lbundle1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1


Gem files will remain installed in /Users/masedesign/Work/repos/code/conf/vms/ruby/jruby-1.6.5/lib/ruby/gems/1.8/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/masedesign/Work/repos/code/conf/vms/ruby/jruby-1.6.5/lib/ruby/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

推荐答案

mysql gem是仅针对MRI(Ruby 1.8)开发和测试的.因此,它在大多数实现中都使用了老式的C扩展.尽管JRuby在技术上支持它们,但它们速度慢且容易出错.所以不要使用它们.

The mysql gem was developed and tested only against MRI (Ruby 1.8). As such it uses old-style C-extensions for most of their implementation. While they are technically supported by JRuby, they are slow and error-prone. So don't use them.

如果使用JRuby,则使用JDBC适配器要好得多,该JDBC适配器使用java-native数据库接口,因此速度更快,并且得到更好的支持.高阶介面(例如Rails所使用的介面)大致相同,您应该不会有任何差异.

If you use JRuby, you are much better off of using the JDBC adapters which use the java-native database interface and are thus much faster and much better supported. The high-level interface (as e.g. used by Rails) is roughly the same, you shouldn't notice any difference.

因此,对于JRuby,您应该使用jdbc-mysql gem,或者-如果您使用Rails-activerecord-jdbcmysql-adapter gem,它需要该gem并添加适当的数据库适配器.

So for JRuby you should use the jdbc-mysql gem, or - if you use Rails - the activerecord-jdbcmysql-adapter gem which requires that gem and adds the appropriate database adapter.

这篇关于在jruby上安装mysql的许多错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆