Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
mysql2捆绑包安装失败_Mysql_Ruby On Rails_Ruby_Mysql2 - Fatal编程技术网

mysql2捆绑包安装失败

mysql2捆绑包安装失败,mysql,ruby-on-rails,ruby,mysql2,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安装时收到此错误: Installing mysql2 0.3.12b5 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native

我正在尝试安装mysql2

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

bundle config build.mysql2 --with-mysql-config=/usr/local/Cellar/mysql/5.6.26/bin/mysql_config
但在运行bundle安装时收到此错误:

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_线程_阻塞_区域相关的解决方案,但没有找到任何有效的解决方案

Ruby:Ruby 2.2.1p85

使用Brew安装mysql

更新:

我能够向bundle配置添加所需的额外标志,这使我能够很好地运行bundle安装

您可以将bundle配置为使用本地mysql的头构建mysql2,并设置标志以解决rb_线程_阻塞_区域:

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

让我们看看您用来安装mysql的命令。在使用apt get的ubuntu上,命令是:sudo apt get install mysql server mysql client libmysqlclient-dev。请注意,除了基本包之外,还有一些库。我怀疑你遇到了类似的情况。@Daiku OP显然不在Ubuntu上,这一行正在检查mysql.h。。。是,明确说明安装了mysql dev。可能与