Many errors installing mysql on jruby

I am trying to get mysql gem installed for use on rails using jruby, can't figure it 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 
+6
source share
2 answers

The mysql jewel was developed and tested only against MRI (Ruby 1.8). Thus, for most of their implementation, C extensions are used for the old style. Although they are technically supported by JRuby, they are slow and error prone. Therefore, do not use them.

If you use JRuby, you are much better off using JDBC adapters that use the java database interface, and thus are much faster and much better supported. The high-level interface (for example, used by Rails) is about the same, you should not notice the differences.

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

+8
source

It seems that this happens from time to time. Here is a post to fooobar.com/questions/198625 / ... with some information (the second and third answers are more like what you are looking for).

In another note, this blog suggests using jdbc-mysql .

0
source

Source: https://habr.com/ru/post/911632/


All Articles