Open AdiLovee opened 2 years ago
@JayeLovee I had the same sort of issue and was able to resolve it by installing MySQL development package. See #1266 .
I was getting the same error. I was able to resolve it by installing a compatible connector for windows.
https://mariadb.com/downloads/connectors/
I did a typical install, and then installed the gem with the following command:
gem install mysql2 -- --with-mysql-dir="C:\Program Files\MariaDB\MariaDB Connector C 64-bit"
I've tried a lot's different ways to install mysql2 gem on Windows Server 2019 and getting this error now:
Ruby v 3
C:\Users\qauser>gem install mysql2 -- --with-mysql-dir="C:\Program Files\MariaDB\MariaDB Connector C 64-bit" ERROR: While executing gem ... (ArgumentError) undefined class/module YAML::Syck::
With ruby 2.7 I was able to install gem without this error.
@dimahadgi I've tried on multiple machines, and I don't get that error.
I'm on ruby 3.1.2p20
. gem -v
gives 3.3.16
. The connector version I downloaded was 3.1.17-GA
. I'd try with those specific versions, as they seem to be the most up to date working combination. You can update rubygems using gem update --system
I had the same issue on Ubuntu 18.04.5, ruby 3.1.2
, gem 3.3.7
. Had to install libmysqlclient-dev.
For some reason, Ruby could not create the makefile for MySql since mkmf.rb#find_library was breaking on a nil value inside the paths array. I've monkey patched to compact this array, them I received the following message:
checking for -lmysqlclient... no
mysql client is missing. You may need to 'sudo apt-get install libmariadb-dev', 'sudo apt-get install libmysqlclient-dev' or 'sudo yum install mysql-devel', and try again.
After that I've installed libmysqlclient-dev and it worked on the next try.
I also encoutnered the same [i think] problem when building mysql2 from MSYS2 environment few days ago. I fixed it with following steps. Replace ucrt with x86_64 for your setup.
1) pacman -S mingw-w64-ucrt-x86_64-libmariadbclient
2) mkdir /tmp/mysql-lib-and-dll
# we need to place dll+lib here; weirdly it seems that lib file is not used, but for some reason build fails without it.
3) touch /tmp/mysql-lib-and-dll/libmysql.lib
# create blank file
4) cp /f/msys/ucrt64/bin/libmariadb.dll /tmp/mysql-lib-and-dll/libmysql.dll
# mysql2 wants dll named libmysql
5) gem install mysql2 -- --with-mysql-lib="/tmp/mysql-lib-and-dll" --with-mysql-include="/f/msys/ucrt64/include/mariadb"
So I actually managed to build without mysql connector from mysql homepage, just using mingw build! I tried a few queries from rails and didnt notice any issues.
mkmf.log