[Ruby] [Windows] Cannot install gem install sqlite3

1 minute read


Terminal: MSYS2(mintty+bash+pacman) Ruby 2.6 + DevKit Windows10 64bit

People who do not care about the version of # SQLite

Install SQLite 1.3.13 Since it has been compiled, no error should occur.

gem install sqlite3 --version 1.3.13 --platform ruby

Look at #mkmf.log ①-package configuration for sqlite3 is not found- ②~Cannot create temporary file in C:\ Hen~ Exploring…

Error coming out

C:\Users\foobar>gem install sqlite3 --platform ruby
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
Warning: mingw-w64-x86_64-sqlite3-x.xx.x-x is up to date--skip
Building native extensions.This could take a while...
ERROR: Error installing sqlite3:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby26-x64/bin/ruby.exe -r ./siteconfyyyymmdd-foooo-baaaaar.rb extconf.rb
*** 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.

Provided configuration options:
C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file.(RuntimeError)
You have to install development tools first.
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:552:in `try_link0'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:570:in `try_link'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:672:in `try_ldflags'
        from C:/Ruby26-x64/lib/ruby/2.6.0/mkmf.rb:1832:in `pkg_config'
        from extconf.rb:35:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:


extconf failed, exit code 1

Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-x.x.x for inspection.
Results logged to C:/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.5.0/sqlite3-x.x.x/gem_make.out