错误:无法使用 ubuntu 20.04 在 wsl2 上构建 gem 原生扩展“mysql”

错误:无法使用 ubuntu 20.04 在 wsl2 上构建 gem 原生扩展“mysql”

我尝试安装gem install mysqlwsl2出现错误。

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1/ext/mysql_api/gem_make.out

之前我尝试过 [这里][1] 和 [这里][2] 列出的这些答案,但对我都不起作用!我也安装了,libmysqlclient-dev mysql-server但这似乎是另一个问题。

编辑:

好吧,有人建议重新安装libmysqlclient-dev apt-get install libmysqlclient-dev,然后我收到另一个错误:

Building native extensions.  This could take a while...
.......

make
gcc -I. -I. -I/usr/local/rvm/rubies/ruby-1.8.7-head/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_RB_STR_SET_LEN -DHAVE_RB_THREAD_START_TIMER -DHAVE_MYSQL_H    -I/usr/include/mysql  -fPIC -O2 -fno-tree-dce -fno-optimize-sibling-calls  -fPIC   -c mysql.c
mysql.c:79:2: error: unknown type name ‘my_bool’
   79 |  my_bool *is_null;
      |  ^~~~~~~
mysql.c: In function ‘options’:
mysql.c:361:5: error: unknown type name ‘my_bool’; did you mean ‘bool’?
  361 |     my_bool b;
      |     ^~~~~~~
      |     bool
.....                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~

      |                                ^
error_const.h:2723:27: error: ‘ER_XPLUGIN_IP’ undeclared (first use in this function); did you mean ‘ER_PLUGIN_OOM’?
 2723 |     rb_define_mysql_const(ER_XPLUGIN_IP);
      |                           ^~~~~~~~~~~~~

Gem files will remain installed in /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.8.7-head/gems/mysql-2.9.1/ext/mysql_api/gem_make.out


  [1]: https://stackoverflow.com/questions/60288130/an-error-occurred-while-installing-mysql-2-9-1-and-bundler-cannot-continue
  [2]: https://stackoverflow.com/questions/5795309/gem-install-mysql-fail

相关内容