Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I had some problems install ruby gem (mysql2) on Windows 10.
I have installed "rubyinstaller-devkit-3.1.2-1-x64.exe".
And I have installed required gem files for my ruby on rails development.
But I can't install mysq2 gem because of error as following
PS C:\Users\ARTIST> gem install mysql2
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: File exists
  if you're sure a package manager is not already
  running, you can remove /var/lib/pacman/db.lck
pacman failed with the following output:
Building native extensions with: '--with-system-libraries'
This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/mysql2-0.5.4/ext/mysql2
C:/Ruby31-x64/bin/ruby.exe -I C:/Ruby31-x64/lib/ruby/3.1.0 -r ./siteconf20220716-5112-ci06hd.rb extconf.rb --with-system-libraries
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
checking for rb_enc_interned_str() in ruby.h... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.


What I have tried:

I searched for google and stack overflow to solve this issue.
There are some issues as same as mine.
So I applied their solutions but it doesn't work!!PS C:\>gem install mysql2 --platform=ruby -- --with-mysql-dir=c:\mariadb-connector-c-3.1.13-src gem install mysql2 --platform=ruby -- --with-system-libraries
But all of these results were just same as above error!!
Help me.
Thanks.
Posted
Updated 16-Jul-22 5:41am
v2
Comments
Richard MacCutchan 16-Jul-22 11:02am    
"error: could not lock database: File exists
if you're sure a package manager is not already
running, you can remove /var/lib/pacman/db.lck
"
Have you checked for this issue?
Member 15708384 16-Jul-22 11:40am    
Sorry, but I am working on Windows 10 system now.
Member 15708384 16-Jul-22 11:45am    
So I can't find the file path: /var/lib/pacman/db.lck
Richard MacCutchan 16-Jul-22 12:07pm    
The messages suggest that it is installing in a Mingw environment, so you probably need to look i all the paths listed in the error messages. Better still, try a Ruby support forum.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900