mysql捆绑的客户端,mysql2捆绑安装失败

I've been hung up on this issue for hours now and nothing I have found previously posted about this issue seems to work. Below is the mysql2 output for when I run bundle install:

Fetching mysql2 0.4.5

Installing mysql2 0.4.5 with native extensions

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

current directory: /Users/MYUSERNAME/Desktop/MY_PROJECT/vendor/ruby/2.4.0/gems/mysql2-0.4.5/ext/mysql2

/Users/MYUSERNAME/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20180623-40170-ndn6t0.rb extconf.rb --with-mysql-config=/usr/local/Cellar/mysql/8.0.11/bin/mysql_config

checking for rb_absint_size()... yes

checking for rb_absint_singlebit_p()... yes

checking for ruby/thread.h... yes

checking for rb_thread_call_without_gvl() in ruby/thread.h... yes

checking for rb_thread_blocking_region()... no

checking for rb_wait_for_single_fd()... yes

checking for rb_hash_dup()... yes

checking for rb_intern3()... yes

checking for rb_big_cmp()... yes

-----

Using mysql_config at /usr/local/Cellar/mysql/8.0.11/bin/mysql_config

-----

checking for mysql.h... yes

checking for SSL_MODE_DISABLED in mysql.h... yes

checking for SSL_MODE_PREFERRED in mysql.h... yes

checking for SSL_MODE_REQUIRED in mysql.h... yes

checking for SSL_MODE_VERIFY_CA in mysql.h... yes

checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes

checking for errmsg.h... yes

checking for mysqld_error.h... yes

-----

Setting rpath to /usr/local/Cellar/mysql/8.0.11/lib

-----

creating Makefile

current directory: /Users/MYUSERNAME/Desktop/MY_PROJECT/vendor/ruby/2.4.0/gems/mysql2-0.4.5/ext/mysql2

make "DESTDIR=" clean

current directory: /Users/MYUSERNAME/Desktop/MY_PROJECT/vendor/ruby/2.4.0/gems/mysql2-0.4.5/ext/mysql2

make "DESTDIR="

compiling client.c

In file included from client.c:1:

In file included from ./mysql2_ext.h:41:

./result.h:24:3: error: unknown type name 'my_bool'

my_bool *is_null;

^

./result.h:25:3: error: unknown type name 'my_bool'

my_bool *error;

^

client.c:507:3: error: use of undeclared identifier 'my_bool'

my_bool res = mysql_read_query_result(client);

^

client.c:509:19: error: use of undeclared identifier 'res'

return (void *)(res == 0 ? Qtrue : Qfalse);

^

client.c:828:3: error: use of undeclared identifier 'my_bool'

my_bool boolval;

^

client.c:859:7: error: use of undeclared identifier 'boolval'

boolval = (value == Qfalse ? 0 : 1);

^

client.c:860:17: error: use of undeclared identifier 'boolval'

retval = &boolval;

^

client.c:863:10: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?

case MYSQL_SECURE_AUTH:

^~~~~~~~~~~~~~~~~

MYSQL_DEFAULT_AUTH

/usr/local/Cellar/mysql/8.0.11/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here

MYSQL_DEFAULT_AUTH,

^

client.c:864:7: error: use of undeclared identifier 'boolval'

boolval = (value == Qfalse ? 0 : 1);

^

client.c:865:17: error: use of undeclared identifier 'boolval'

retval = &boolval;

^

client.c:896:38: error: use of undeclared identifier 'boolval'

wrapper->reconnect_enabled = boolval;

^

client.c:1285:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?

return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);

^~~~~~~~~~~~~~~~~

MYSQL_DEFAULT_AUTH

/usr/local/Cellar/mysql/8.0.11/include/mysql/mysql.h:188:3: note: 'MYSQL_DEFAULT_AUTH' declared here

MYSQL_DEFAULT_AUTH,

^

12 errors generated.

make: *** [client.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/MYUSERNAME/Desktop/MY_PROJECT/vendor/ruby/2.4.0/gems/mysql2-0.4.5 for inspection.

Results logged to /Users/MYUSERNAME/Desktop/MY_PROJECT/vendor/ruby/2.4.0/extensions/x86_64-darwin-17/2.4.0-static/mysql2-0.4.5/gem_make.out

An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue.

Make sure that `gem install mysql2 -v '0.4.5'` succeeds before bundling.

In Gemfile:

mysql2

This is the relevant portion of my Gemfile:

gem 'rails', '5.1.4'

gem 'mysql2', '0.4.5'

I'm running MacOS High Sierra and have MySQL installed via Homebrew. I've tried running as bundle install --system, adding /tmp/mysql.sock to my database.yml (it was already there), as well as reinstalling just about every relevant dev tool on my system, all with no luck.

Its also worth noting that I've done this in the past with no issues... I'm not really sure what changed, but it seems to only be a problem on my system.

Thanks for any help you can provide

UPDATE: I'm able to the the gem for mysql2 v0.4.5 to install properly when I run gem install mysql2 -v '0.4.5' -- --srcdir=/usr/local/Cellar/mysql/8.0.11/include/

解决方案

So the problem ended up being that homebrew recently made mysql v8.x.x the standard installation and I ran homebrew upgrades which took me off the standard that our codebase supported... Noted for the future. Once I brought my system mysql version down to accurately reflect what mysql2 was looking for, it worked.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值