rails new blog failing to install - ruby-on-rails

I'm following a tutorial to set up a simple Ruby on Rails blog but when I enter "rails new blog" I get the following error.
Does anyone know what the problem is? I have no experience using Rails and just recently started learning Ruby, and help would be appreciated. Thanks!
Ruby Version: ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]
Rails Version: Rails 5.2.3
OS: Windows 10 64 bit
I've tried the advice in the command prompt, running the line:
gem install sqlite3 -v '1.4.0' -- source 'https://rubygems.org/'
But I get this error:
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection.
Results logged to C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/gem_make.out
Error After intiially running : rails new blog
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection.
Results logged to
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
sqlite3
This is what's inside the gem_make.out file
current directory: C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20190424-3264-12r4lo3.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for dlopen()... no
missing function dlopen
*** 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:/Ruby25-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-pthreadlib
--without-pthreadlib
--with-dllib
--without-dllib
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1

Gemfile
replace gem 'sqlite3' to
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

Will you try this gem?
It probably has to figure it out.
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"

Related

Cannot create Rails project, but sqlite is installed

I am trying to get into Ruby on Rails. I have followed this: http://installrails.com/steps/create_your_first_app
But when I type rails new sample_app I get this error:
current directory:
c:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.1/ext/sqlite3
c:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190630-14364-17waap6.rb
extconf.rb
checking for sqlite3.h... no
sqlite3.h 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:/RailsInstaller/Ruby2.3.3/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
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
c:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
c:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.1 for
inspection.
Results logged to
c:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.1/gem_make.out
An error occurred while installing sqlite3 (1.4.1), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.1'` succeeds before bundling.
In Gemfile:
sqlite3
But if I then runs the gem install sqlite3 -v '1.4.1' line, I get this message, which looks like a success.
gem install sqlite3
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-sqlite3
advarsel: mingw-w64-x86_64-sqlite3-3.27.2-2 er opdateret - springer over
Building native extensions. This could take a while...
Successfully installed sqlite3-1.4.1
Parsing documentation for sqlite3-1.4.1
Done installing documentation for sqlite3 after 2 seconds
1 gem installed
But I still can't create a new project.
Any Ideas?
Execute below commands it may help to you
ridk exec pacman -S mingw-w64-x86_64-sqlite3
ridk exec pacman -S mingw-w64-x86_64-dlfcn
gem install sqlite3
bundle install

bundle cant install sqlite3 -v 1.4.0

I'm new to ruby on rails, having a problem with installing sqlite3 -v 1.4.0
each time I run bundle install
and am not able to start rails server because of this.
I am on windows 7
current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190428-4968-1wrdwr0.rb
extconf.rb
checking for sqlite3.h... no
sqlite3.h 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:/RailsInstaller/Ruby2.3.3/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
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0'` succeeds before bundling.
In Gemfile:
sqlite3
c:\Sites\blog>
Your error contains a recommendation inside it:
sqlite3.h is missing. Install SQLite3 from http://www.sqlite.org/ first
sqlite3 gem is only a wrapper around it, you need SQLite in your system to compile and install it.
type ridk exec pacman -S mingw-w64-x86_64-dlfcn in command line, install this, and try again

Gem::Ext::BuildError: ERROR: Failed to build gem native extension. for SQlite3

I keep getting the below error in rails on windows when I try to make a new rails app? It fails when it gets to installing sqlite3.
current directory:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/Ruby25-x64/bin/ruby.exe -r ./siteconf20190220-14164-174xy0j.rb extconf.rb
checking for sqlite3.h... yes
checking for pthread_create() in -lpthread... yes
checking for -ldl... no
checking for dlopen()... no
missing function dlopen
*** 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:/Ruby25-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-pthreadlib
--without-pthreadlib
--with-dllib
--without-dllib
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection.
Results logged to
C:/Ruby25-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.
I have sqlite3 installed on my machine and I am using windows 10. I have attempted ot run the gem install sqlite3 command like it prompts me to but it still fails what am I doing wrong?
Try this
$ sudo apt-get install libsqlite3-dev
then,
$ bundle install
Probably, you use different rails version.
Solution is change version of sqlite to 1.3.6:
gem 'sqlite3', '~> 1.3.6'
After this change run command:
bundle update
Hi I got the same message when tried to install SQLite gem without MinGW gem installed already
C:\Sites>ridk exec pacman -S mingw-w64-x86_64-dlfcn
Install it and try again
If you DON'T have installed RailsInstaller only Ruby DevKit it should work. If not please try uninstalling it first, removing the remaining folders and installing rails by command gem install rails
Try uninstalling all the versions of the sqlite3 gem from the system and reinstalling only version 1.4.0

I am getting this error while executing cmd "rails new test_install" on my windows

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190220-5856-12t9mtl.rb
extconf.rb
checking for sqlite3.h... no
sqlite3.h 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:/RailsInstaller/Ruby2.3.3/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
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sql
ite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that gem install sqlite3 -v '1.4.0' succeeds before bundling.
In Gemfile:
sqlite3
Probably, you use rails in 5.2.2 version. Solution is change version of sqlite to 1.3.6:
gem 'sqlite3', '~> 1.3.6'
After this change run command:
bundle update
I have got the same issue and tried for more than a week a lot of solutions the only one worked for me was uninstall RailsInstaller only install Ruby DevKit (make sure all the folders of RailsInstaller installation are gone or you'll see a message "C:/RailsInstaller/Ruby2.3.3/bin" cannot be found when trying to use gem command) install rails by command line C:/Sites > gem install rails and install MinGW
C:\Sites>ridk exec pacman -S mingw-w64-x86_64-dlfcn
Download the SQLite3 gem from https://rubygems.org/, save it locally and install it from file
C:\Sites>gem install --local C:\sqlite3-1.4.0.gem
The good thing is it worked for all the projects that I created after.

How to install sqlite3 for ruby on rails for windows10

When I am invoking rails to build the skeleton of a new application ie rails 5.1.3 new flix, I am getting the error ie the last part of command output is
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190222-12524-hspyoq.rb
extconf.rb
checking for sqlite3.h... no
sqlite3.h 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:/RailsInstaller/Ruby2.3.3/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
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for
inspection.
Results logged to
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.out
An error occurred while installing sqlite3 (1.4.0), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.4.0'` succeeds before bundling.
In Gemfile:
sqlite3
When I am running gem install sqlite3 -v '1.4.0', I get the below error message
C:\Users\acer>gem install sqlite3 -v '1.4.0'
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0/ext/sqlite3
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190222-11816-8sfvgr.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h 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:/RailsInstaller/Ruby2.3.3/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
To see why this extension failed to compile, please check the mkmf.log which can be found here:
C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/sqlite3-1.4.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/sqlite3-1.4.0/gem_make.out
If anyone has installed sqlite in windows 10, please guide me.
Thanks a lot in advance.
As written in the error messages, you need to install SQLite 3 on your computer first (http://www.sqlite.org/). The ruby gem sqlite3 only gives you a way of using SQLite 3 from Ruby, but it needs to be installed on your system nonetheless.
I have just installed my ruby on rails today being 10th of April 2019. I took out my time to write this
I encountered the same issues when I tried to my rails app working directory.
Here is the step that I followed that works excellent without any error.
1.) Download Ruby installer from
link
Here I downloaded Ruby+Devkit 2.6.1-1 (x86) because am using window OS 32 bit.
Run the installation file
2.)check if the ruby is installed by evaluating its version
at command prompt type
ruby -v
you will see output Eg. ruby 2.6.1p33
3 Install Rails
at command prompt run
gem install rails
4.) To check rail version installed.
At command prompt run
rails -v
you will see output Eg. rails 5.2.3
5.)To create an application directory eg rails project. Cd C:> to any directory location and type
rails new myRailsApp
This will create myRailsApp at c:/ directory if everything were okay.
In your case it will work at this point and that is why it shows the error above.
Note:
But Remember that your app working directory**(myRailsApp)** were created despite the error you posted above which was caused by sqlite3.
At this point open your app directory and type the code below at command propmt to update some missing gem files
C:\myRailsApp>ridk exec pacman -S mingw-w64-x86_64-dlfcn
Press enter and it will be installed.
Now open a file called GemFile at your root application directory eg. C:\myRailsApp
There change this line
gem 'sqlite3'
to this below and save
gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
The solution here is based on Larskanis approach
Then run bundle install at
C:\myRailsApp>bundle install
and your app will compile without any error.
To test if the ruby is running
start the server with command rails server at your project directory
C:\myRailsApp>rails server
or you can also start it by navigating to the bin directory
C:\myRailsApp\bin>rails server
open browser at http://localhost:3000 and viola!!!
I resolved it with this command:
gem install sqlite3 ver '1.4.0' — source 'https://rubygems.org/'

Resources