捆绑安装失败,使用mysql2

时间:2015-09-01 13:30:34

标签: mysql ruby-on-rails ruby mysql2

我试图让mysql2安装。

我已将此添加到我的配置中:

bundle config build.mysql2 --with-mysql-config=/usr/local/Cellar/mysql/5.6.26/bin/mysql_config

但在运行bundle install时收到此错误:

Installing mysql2 0.3.12b5 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/Users/click/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150901-49830-hf7d1e.rb extconf.rb --with-mysql-config=/usr/local/Cellar/mysql/5.6.26/bin/mysql_config
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling client.c
In file included from client.c:1:
In file included from ./mysql2_ext.h:39:
In file included from ./client.h:11:
/Users/click/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward/rubysig.h:14:2: warning: rubysig.h is obsolete [-W#warnings]
#warning rubysig.h is obsolete
^
In file included from client.c:1:
In file included from ./mysql2_ext.h:39:
./client.h:13:14: warning: redefinition of typedef 'rb_unblock_function_t' is a C11 feature [-Wtypedef-redefinition]
typedef void rb_unblock_function_t(void *);
         ^
/Users/click/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:897:14: note: previous definition is here
typedef void rb_unblock_function_t(void *);
         ^
In file included from client.c:1:
In file included from ./mysql2_ext.h:39:
./client.h:14:15: warning: redefinition of typedef 'rb_blocking_function_t' is a C11 feature [-Wtypedef-redefinition]
typedef VALUE rb_blocking_function_t(void *);
          ^
/Users/click/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/intern.h:898:15: note: previous definition is here
typedef VALUE rb_blocking_function_t(void *);
          ^
In file included from client.c:1:
In file included from ./mysql2_ext.h:39:
./client.h:23:3: error: use of undeclared identifier 'TRAP_BEG'
TRAP_BEG;
^
./client.h:25:3: error: use of undeclared identifier 'TRAP_END'
TRAP_END;
^
3 warnings and 2 errors generated.
make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/click/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.12b5 for inspection.
Results logged to /Users/click/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/mysql2-0.3.12b5/gem_make.out
An error occurred while installing mysql2 (0.3.12b5), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.12b5'` succeeds before bundling.

我搜索了与rb_thread_blocking_region()相关的解决方案,但未找到任何有效的解决方案。

Ruby:ruby 2.2.1p85。

使用Brew安装mysql。

更新

我能够添加捆绑配置所需的额外标志,这使我可以运行捆绑安装。

您可以配置bundle以使用本地mysql的头文件构建mysql2并设置标志来解决rb_thread_blocking_region:

bundle config build.mysql2 --with-mysql-config=/usr/local/Cellar/mysql/5.6.26/bin/mysql_config --with-cflags=\"-DHAVE_RB_THREAD_BLOCKING_REGION\"

然而,当我运行sphinx搜索时,我收到此错误:

dyld: lazy symbol binding failed: Symbol not found: _rb_thread_blocking_region
Referenced from: /Users/click/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.12b5/lib/mysql2/mysql2.bundle
Expected in: flat namespace

dyld: Symbol not found: _rb_thread_blocking_region
Referenced from: /Users/click/.rvm/gems/ruby-2.2.1/gems/mysql2-0.3.12b5/lib/mysql2/mysql2.bundle
Expected in: flat namespace

[1]    61566 trace trap  rails s

0 个答案:

没有答案