【问题标题】:I get an error when trying to bundle install尝试捆绑安装时出现错误
【发布时间】:2021-05-25 11:27:18
【问题描述】:
gem install mysql2 -v '0.3.21' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: /home/tatarski/.rvm/gems/ruby-2.3.8/gems/mysql2-0.3.21/ext/mysql2
/usr/share/rvm/rubies/ruby-2.3.8/bin/ruby -I /usr/share/rvm/rubies/ruby-2.3.8/lib/ruby/site_ruby/2.3.0 -r ./siteconf20210223-17291-11rjqor.rb extconf.rb
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
-----
Using mysql_config at /usr/bin/mysql_config
-----
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Setting libpath to /usr/lib/x86_64-linux-gnu
-----
creating Makefile

current directory: /home/tatarski/.rvm/gems/ruby-2.3.8/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR=" clean

current directory: /home/tatarski/.rvm/gems/ruby-2.3.8/gems/mysql2-0.3.21/ext/mysql2
make "DESTDIR="
compiling client.c
client.c: In function 'nogvl_read_query_result':
client.c:439:3: error: unknown type name 'my_bool'
   my_bool res = mysql_read_query_result(client);
   ^
client.c: In function '_mysql_client_options':
client.c:762:3: error: unknown type name 'my_bool'
   my_bool boolval;
   ^
client.c:797:10: error: 'MYSQL_SECURE_AUTH' undeclared (first use in this function)
     case MYSQL_SECURE_AUTH:
          ^
client.c:797:10: note: each undeclared identifier is reported only once for each function it appears in
client.c: In function 'set_secure_auth':
client.c:1185:38: error: 'MYSQL_SECURE_AUTH' undeclared (first use in this function)
   return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
                                      ^
client.c:1186:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [Makefile:239: client.o] Error 1

make failed, exit code 2

这是我得到的全部错误。 有谁知道如何解决这一问题。 以前的线程是旧的/他们的解决方案不起作用。 我试过了: sudo apt-get install ruby​​-mysql 并得到: 阅读包裹清单...完成 构建依赖树
读取状态信息...完成 E: 找不到包 ruby​​-mysql

【问题讨论】:

    标签: c ruby-on-rails ruby rubygems


    【解决方案1】:

    https://github.com/brianmario/mysql2 正如这里提到的,在安装 gem 之前你需要先安装一些 Linx 包

    【讨论】:

    • 安装了软件包。宝石上仍然没有进展
    • 同样的错误?也尝试“sudo apt-get install build-essential”,因为这是与构建原生扩展相关的失败
    • 好的,所以我安装了 brew,我猜它有问题。另外,我继续使用 docker。谢谢!
    最近更新 更多