Home > Back-end >  Cannot install ruby MySQL gem on windows
Cannot install ruby MySQL gem on windows

Time:09-21

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

CodePudding user response:

Try solution from this https://github.com/brianmario/mysql2/issues/1005

Especially, $ bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include"

CodePudding user response:

All i had to do was go run msys2 from the ruby installation dir. Generate my pacman key and retry the build by using mysql connector

  • Related