an attempt to install ‘mysql2’ gem in Windows 10 fails. I did some search on internet and tried multiple suggestions without success.
As suggested in mysql2 gem documentation the MySQL Connector/C downloaded and unarchived into c:MySQL directory.
Then a command was issued
gem install mysql2 --platform=ruby -- '--with-mysql-dir=c:MySQLmysql-connector-c-6.1.11-winx64'
what has produced following output
C:WINDOWSsystem32>gem install mysql2 --platform=ruby -- '--with-mysql-dir=c:MySQLmysql-connector-c-6.1.11-winx64'
Using rubygems directory: C:/Users/John Smith/.gem/ruby/3.3.0
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-ucrt-x86_64-libmariadbclient
error: failed to init transaction (unable to lock database)
error: could not lock database: Permission denied
pacman failed with the following output:
Building native extensions with: '--with-mysql-dir=c:MySQLmysql-connector-c-6.1.11-winx64'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
current directory: C:/Users/John Smith/.gem/ruby/3.3.0/gems/mysql2-0.5.6/ext/mysql2
C:/bin/Ruby33-x64/bin/ruby.exe extconf.rb --with-mysql-dir=c:\MySQL\mysql-connector-c-6.1.11-winx64
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_gc_mark_movable()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... yes
-----
Using --with-mysql-dir=c:MySQLmysql-connector-c-6.1.11-winx64
-----
checking for -lmysqlclient... no
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_DEFAULT_AUTH in mysql.h... yes
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... yes
checking for mysql_ssl_set() in mysql.h... no
-----
Setting rpath to /lib
-----
creating Makefile
current directory: C:/Users/John Smith/.gem/ruby/3.3.0/gems/mysql2-0.5.6/ext/mysql2
make DESTDIR= sitearchdir=./.gem.20240624-23736-20lfro sitelibdir=./.gem.20240624-23736-20lfro clean
current directory: C:/Users/John Smith/.gem/ruby/3.3.0/gems/mysql2-0.5.6/ext/mysql2
make DESTDIR= sitearchdir=./.gem.20240624-23736-20lfro sitelibdir=./.gem.20240624-23736-20lfro
generating mysql2-x64-mingw-ucrt.def
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.so
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1f3): undefined reference to `mysql_send_query'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x256): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x279): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x29c): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2bf): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2e2): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x32b): undefined reference to `mysql_real_connect'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x3a9): undefined reference to `mysql_options4'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x3cd): undefined reference to `mysql_init'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x4a1): undefined reference to `mysql_session_track_get_first'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x4de): undefined reference to `mysql_session_track_get_next'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x54f): undefined reference to `mysql_session_track_get_first'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x58e): undefined reference to `mysql_session_track_get_next'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x5e6): undefined reference to `mysql_get_ssl_cipher'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x646): undefined reference to `mysql_info'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x6a5): undefined reference to `mysql_warning_count'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x6dd): undefined reference to `mysql_use_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x6fd): undefined reference to `mysql_store_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x725): undefined reference to `mysql_more_results'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x768): undefined reference to `mysql_set_server_option'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x79c): undefined reference to `mysql_select_db'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x7b5): undefined reference to `mysql_ping'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x7d5): undefined reference to `mysql_read_query_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x84b): undefined reference to `mysql_get_server_version'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x86b): undefined reference to `mysql_get_server_info'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x980): undefined reference to `mysql_get_client_info'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x9c4): undefined reference to `mysql_get_client_version'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xa50): undefined reference to `mysql_get_client_version'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xa57): undefined reference to `mysql_get_client_info'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xab5): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xbc9): undefined reference to `mysql_thread_id'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xca9): undefined reference to `mysql_insert_id'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xd1e): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xd32): undefined reference to `mysql_sqlstate'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xd79): undefined reference to `mysql_errno'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xdf5): undefined reference to `mysql_next_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xe1c): undefined reference to `mysql_more_results'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xe34): undefined reference to `mysql_free_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xe7d): undefined reference to `mysql_affected_rows'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0xef9): undefined reference to `mysql_next_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1058): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x10b0): undefined reference to `mysql_get_server_version'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1154): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1193): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x11e7): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1355): undefined reference to `mysql_close'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x143d): undefined reference to `mysql_errno'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x14e8): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1514): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1820): undefined reference to `mysql_escape_string'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x191f): undefined reference to `mysql_real_escape_string'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x19f5): undefined reference to `mysql_close'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1afd): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1b42): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1d4d): undefined reference to `mysql_errno'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1e19): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1e3d): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1ef7): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1f1b): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1fd2): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x1ff5): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x20b2): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x20d5): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2192): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x21b5): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2269): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2295): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x236b): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2390): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2490): undefined reference to `mysql_options'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x24b5): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x25f5): undefined reference to `mysql_close'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2627): undefined reference to `mysql_get_client_info'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: client.o:client.c:(.text+0x2697): undefined reference to `mysql_server_init'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: infile.o:infile.c:(.text+0x1cb): undefined reference to `mysql_set_local_infile_handler'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x6a): undefined reference to `mysql_stmt_num_rows'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0xb5): undefined reference to `mysql_num_rows'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x16d): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x1ac): undefined reference to `mysql_fetch_field_direct'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x295): undefined reference to `mysql_stmt_fetch'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x3a6): undefined reference to `mysql_free_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x3d5): undefined reference to `mysql_stmt_free_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x75b): undefined reference to `mysql_fetch_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x7b3): undefined reference to `mysql_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x874): undefined reference to `mysql_fetch_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x998): undefined reference to `mysql_data_seek'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x9e6): undefined reference to `mysql_stmt_num_rows'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0xa65): undefined reference to `mysql_num_rows'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0xba2): undefined reference to `mysql_stmt_bind_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0xe15): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x215d): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x21a0): undefined reference to `mysql_fetch_field_direct'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x221d): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x26f7): undefined reference to `mysql_fetch_lengths'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x3b41): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x3f19): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x3f58): undefined reference to `mysql_fetch_field_direct'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x3fc5): undefined reference to `mysql_fetch_field_direct'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x4045): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x4075): undefined reference to `mysql_num_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: result.o:result.c:(.text+0x231): undefined reference to `mysql_fetch_row'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x22): undefined reference to `mysql_stmt_close'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x53): undefined reference to `mysql_stmt_prepare'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x75): undefined reference to `mysql_stmt_execute'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x181): undefined reference to `mysql_stmt_insert_id'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x1f1): undefined reference to `mysql_stmt_field_count'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x251): undefined reference to `mysql_stmt_param_count'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x2b8): undefined reference to `mysql_stmt_close'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x2f8): undefined reference to `mysql_stmt_close'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x355): undefined reference to `mysql_stmt_error'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x369): undefined reference to `mysql_stmt_sqlstate'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x3dd): undefined reference to `mysql_stmt_errno'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x455): undefined reference to `mysql_stmt_affected_rows'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x520): undefined reference to `mysql_stmt_result_metadata'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x534): undefined reference to `mysql_fetch_fields'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x53f): undefined reference to `mysql_stmt_field_count'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x5a1): undefined reference to `mysql_free_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x5fc): undefined reference to `mysql_stmt_errno'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x6e2): undefined reference to `mysql_stmt_param_count'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x83e): undefined reference to `mysql_stmt_result_metadata'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x85d): undefined reference to `mysql_stmt_store_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x905): undefined reference to `mysql_stmt_attr_set'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0xbfb): undefined reference to `mysql_stmt_bind_param'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0xed5): undefined reference to `mysql_stmt_errno'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x11db): undefined reference to `mysql_free_result'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x1289): undefined reference to `mysql_stmt_init'
C:/bin/Ruby33-x64/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: statement.o:statement.c:(.text+0x12ba): undefined reference to `mysql_stmt_attr_set'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:265: mysql2.so] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Users/John Smith/.gem/ruby/3.3.0/gems/mysql2-0.5.6 for inspection.
Results logged to C:/Users/John Smith/.gem/ruby/3.3.0/extensions/x64-mingw-ucrt/3.3.0/mysql2-0.5.6/gem_make.out
It looks like compilation stage is successful but linker fails to build a library file. It is not clear why linker (collect2.exe) does not find reference to subroutines defined in libmysql.dll library of MySQL Connector/C.
I have used Dependencies to verify referenced subroutines in the library file and puzzled why it fails to link.
In the mysql2 documentation it is mentioned that without specifying –with-mysql-dir option gem installer suppose to download connector but it does not happen.
Is there a soul who recently was able successfully install mysql2 gem in Windows 10?
Thank you in advance for your assistance in resolution of this issue.
Polar Bear