'Unable to install sqlite3 gem

I have an issue trying to install the sqlite3 gem using Ruby on Rails 3.0.1.

Using Windows 10 21H2 x64. The SQLite engine is installed.

Below is the error message from “C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/sqlite3-1.4.2/mkmf.log”

“x86_64-w64-mingw32-gcc -o conftest.exe -IC:/Ruby30-x64/include/ruby-3.0.0/x64-mingw32 -IC:/Ruby30-x64/include/ruby-3.0.0/ruby/backward -IC:/Ruby30-x64/include/ruby-3.0.0 -I. -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0600 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64 -O3 -fno-fast-math -fstack-protector-strong conftest.c -L. -LC:/Ruby30-x64/lib -L. -pipe -s -fstack-protector-strong -m64 -lpthread -lx64-msvcrt-ruby300 -lsqlite3 -lpthread -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi " C:/Ruby30-x64/msys64/mingw64/bin/…/lib/gcc/x86_64-w64-mingw32/10.2.0/…/…/…/…/x86_64-w64-mingw32/bin/ld.exe: cannot find -lsqlite3 collect2.exe: error: ld returned 1 exit status checked program was: /* begin / 1: #include “ruby.h” 2: 3: #include <winsock2.h> 4: #include <windows.h> 5: 6: /top/ 7: extern int t(void); 8: int main(int argc, char *argv) 9: { 10: if (argc > 1000000) { 11: int ( volatile tp)(void)=(int ()(void))&t; 12: printf(”%d", (tp)()); 13: } 14: 15: return !!argv[argc]; 16: } 17: extern void sqlite3_libversion_number(); 18: int t(void) { sqlite3_libversion_number(); return 0; } / end *

I have provided the gem install sqlite3 output below:

C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/digest-3.0.0/lib/digest.rb:6: warning: already initialized constant Digest::REQUIRE_MUTEX
C:/Ruby30-x64/lib/ruby/3.0.0/digest.rb:6: warning: previous definition of REQUIRE_MUTEX was here
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
error: mingw-w64-x86_64-termcap: signature from "David Macek <[email protected]>" is unknown trust
error: mingw-w64-x86_64-readline: signature from "David Macek <[email protected]>" is unknown trust
error: failed to commit transaction (invalid or corrupted package)
pacman failed with the following output:
resolving dependencies...
looking for conflicting packages...

Packages (4) mingw-w64-x86_64-readline-8.0.004-2  mingw-w64-x86_64-tcl-8.6.11-3  mingw-w64-x86_64-termcap-1.3.1-6  mingw-w64-x86_64-sqlite3-3.35.4-2

Total Download Size:    0.40 MiB
Total Installed Size:  59.88 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
downloading mingw-w64-x86_64-termcap-1.3.1-6-any.pkg.tar.zst...
downloading mingw-w64-x86_64-readline-8.0.004-2-any.pkg.tar.zst...
checking keyring...
checking package integrity...
:: File /var/cache/pacman/pkg/mingw-w64-x86_64-termcap-1.3.1-6-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]
:: File /var/cache/pacman/pkg/mingw-w64-x86_64-readline-8.0.004-2-any.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]
Errors occurred, no packages were upgraded.
Building native extensions. This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.

    current directory: C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2/ext/sqlite3
C:/Ruby30-x64/bin/ruby.exe -I C:/Ruby30-x64/lib/ruby/3.0.0 -r ./siteconf20220513-19776-vbg7uj.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Install SQLite3 from http://www.sqlite.org/ first.
*** 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:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=C:/Ruby30-x64/bin/$(RUBY_BASE_NAME)
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-config
    --without-sqlite3-config
    --with-pkg-config
    --without-pkg-config
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib
    --with-pthread-dir
    --without-pthread-dir
    --with-pthread-include
    --without-pthread-include=${pthread-dir}/include
    --with-pthread-lib
    --without-pthread-lib=${pthread-dir}/lib
    --with-pthreadlib
    --without-pthreadlib
    --with-dl-dir
    --without-dl-dir
    --with-dl-include
    --without-dl-include=${dl-dir}/include
    --with-dl-lib
    --without-dl-lib=${dl-dir}/lib
    --with-dllib
    --without-dllib
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3lib
    --without-sqlite3lib

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

C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/sqlite3-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/sqlite3-1.4.2 for inspection.
Results logged to C:/Ruby30-x64/lib/ruby/gems/3.0.0/extensions/x64-mingw32/3.0.0/sqlite3-1.4.2/gem_make.out


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source