Ruby Ruby on Rails 5 Basics Creating an App Creating a Rails App

Dan Maliano
Dan Maliano
11,151 Points

sqlite3 failed please help=)

after installing rails I keep getting this message when I try to launch new blog with "rails new blog" :

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

D:/Programs/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in D:/Programs/Ruby25/lib/ruby/gems/2.5.0/gems/sqlite3-1.4.0 for inspection. Results logged to D:/Programs/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-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

What should I do next?

4 Answers

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

As the output says, you will need to check the contents of the file:

D:/Programs/Ruby25/lib/ruby/gems/2.5.0/extensions/x86-mingw32/2.5.0/sqlite3-1.4.0/mkmf.log

Try searching for any errors that you see in that file on Google. If you are still having trouble, please copy the contents of that file and paste them in a comment on this forum post.

Dan Maliano
Dan Maliano
11,151 Points

so I get this error while I'm attempting to install rails actually ...

this is from mkmf.log on windows:

"pkg-config --exists sqlite3"
package configuration for sqlite3 is not found
find_header: checking for sqlite3.h... -------------------- no

"i686-w64-mingw32-gcc -o conftest.exe -ID:/Programs/Ruby25/include/ruby-2.5.0/i386-mingw32 -ID:/Programs/Ruby25/include/ruby-2.5.0/ruby/backward -ID:/Programs/Ruby25/include/ruby-2.5.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -march=i686 -mtune=generic -O2 -pipe conftest.c  -L. -LD:/Programs/Ruby25/lib -L. -pipe -s     -lmsvcrt-ruby250  -lgmp -lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi  "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: int main(int argc, char **argv)
6: {
7:   return 0;
8: }
/* end */

"i686-w64-mingw32-gcc -E -ID:/Programs/Ruby25/include/ruby-2.5.0/i386-mingw32 -ID:/Programs/Ruby25/include/ruby-2.5.0/ruby/backward -ID:/Programs/Ruby25/include/ruby-2.5.0 -I. -D_FORTIFY_SOURCE=2 -D__USE_MINGW_ANSI_STDIO=1 -DFD_SETSIZE=2048 -D_WIN32_WINNT=0x0501 -D__MINGW_USE_VC2005_COMPAT -D_FILE_OFFSET_BITS=64  -march=i686 -mtune=generic -O2 -pipe  conftest.c -o conftest.i"
conftest.c:5:10: fatal error: sqlite3.h: No such file or directory
 #include <sqlite3.h>
          ^~~~~~~~~~~
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: #include <winsock2.h>
4: #include <windows.h>
5: #include <sqlite3.h>
/* end */
Jay McGavren
Jay McGavren
Treehouse Teacher

Did you install Rails according to these directions? In particular, you need to follow the steps regarding the "Ruby Development Kit".

Dan Maliano
Dan Maliano
11,151 Points

I followed your instructions and I got this error below while installing rails 5.0.0 so I tried different versions to see what would happen. with ruby 2.5.0 I get the 'sqlite3' error during rails installation and with ruby 2.2.5p319 I get this error immediately it's not running an installation at all:

C:\Users\dbm10>ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [i386-mingw32]

C:\Users\dbm10>gem install rails --version 5.0.0
ERROR:  Could not find a valid gem 'rails' (= 5.0.0), here is why:
          Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

I downloaded ruby + devkit (I already got nodejs) after devkit I restarted and did "gem install rails --version 5.0.0"

right now ruby 2.2.5 it is the only version available on my computer + if it is helping, Sinatra runs great on my computer

Jay McGavren
Jay McGavren
Treehouse Teacher

SSL certificate errors can be a pain to fix, I'm afraid. You'll need to follow the instructions at this link.

Dan Maliano
Dan Maliano
11,151 Points

Thank you, very much Jay=) One more thing PLEASE if you could just give me some hint because I'm not getting any answer to this post. why is it not working I will so appreciate it... (bonus part/ Sinatra - build navigation with .each)

https://teamtreehouse.com/community/in-the-wiki-app-add-a-list-of-all-the-available-wiki-pages-the-dir-class-from-ruby-core-has-an-each-method-help

here it is:

I'm trying to output the "pages" directory as navigation, please help =)

(from Ruby track, last part - Sinatra, the final lesson - from the teacher notes)


version 1

wiki.rb

def nav
d = Dir.new("pages")
d.each  {|x| puts "#{x}" }
end 

get "/" do
  Mackenzie Steele  = nav
  erb :welcome
end

welcome.erb

<ul>
<li><a href="/<%= Mackenzie Steele  %>"><%= @m %></a></li>
</ul>


version 2

wiki.rb

def nav
d = Dir.new("pages")
d.each  {|x| puts "<li><a href=\"/#{x}\">#{x}</a></li>" }
end 

get "/" do
  @m  = nav
  erb :welcome
end

welcome.erb

<ul>
    <%= @m %>
</ul>

What am I doing wrong?

Dan Maliano
Dan Maliano
11,151 Points

I successfully installed Ruby 2.2.5 & ROR 5.0.0 on a Ubuntu virtual box instead =)) I will try to get ROR to work on windows after I finish the rails track just for the name of solving this thing=)

Jay McGavren
Jay McGavren
Treehouse Teacher

Dan Maliano sorry I've responded on your other post; sorry I didn't see it before!

Ingenious Courses
Ingenious Courses
5,353 Points

Hey! I've found the same problem! Did you get the answer?

Dan Maliano
Dan Maliano
11,151 Points

Thank you Jay I really appreciate it=)