首页 > 解决方案 > Cannot install ruby MySQL gem on windows

问题描述

When I run :

gem install mysql2 -- --with-mysql-lib=C:\wamp64\bin\mysql\mysql8.0.21\lib --with-mysql-include=C:\wamp64\bin\mysql\mysql8.0.21\include

I still get the error:

ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/mysql2-0.5.3/ext/mysql2
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/3.0.0 -r ./siteconf20210919-5108-35pas9.rb extconf.rb --with-mysql-lib\=C:\\wamp64\\bin\\mysql\\mysql8.0.21\\lib --with-mysql-include\=C:\\wamp64\\bin\\mysql\\mysql8.0.21\\include
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
-----
Using --with-mysql-dir=C:\wamp64\bin\mysql\mysql8.0.21
-----
checking for -lmysqlclient... yes
checking for mysql.h... yes
checking for errmsg.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 MYSQL.net.vio in mysql.h... yes
checking for MYSQL.net.pvio in mysql.h... no
checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
checking for my_bool in mysql.h... 

And this isn't even 1% of the total error message

I've been on this for days and I have no idea what to do. I'm seriously considering dropping ruby and rails

标签: mysqlruby-on-railsruby

解决方案


我所要做的就是从 ruby​​ 安装目录运行 msys2。生成我的 pacman 密钥并使用 mysql 连接器重试构建


推荐阅读