sqlite3 Failed to build gem native extension

hello all,
this is driving me crazy, and i have tried everything and looked
everywhere and i cannot resolve this problem.

when i do bundle install in a rails app, i get an error "Failed to
build gem native extension" during sqlite3. i have included the entire
error below.
i have rails 3.0.3, ruby 1.8.7, and sqlite3 installed (although i cant
see it in gem list). i have OS X 10.5.8, XCode 3.1.4. this is running
on a PPC machine.
the weird thing is, this just started out of nowhere. i have been
learning rails for a few months, and this error just started occurring
without me upgrading or installing anywhere. in fact, this runs on a
PMG5 which is only used for this.
just a few things i have tried from searching the web, the forums, and
the mailing groups are upgrading everything (rails, gems, ruby, xcode,
sqlite), compiling and installing sqlite, trying to use mysql instead,
taking all instances of sqlite out of my gemfile, i think there were a
few more...

so here are the errors, and below that is the relevant mkmf.log. thank
you to anyone in advance who has a suggestion!

Installing sqlite3-ruby (1.3.2) with native extensions /usr/local/lib/
ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions':
ERROR: Failed to build gem native extension.
(Gem::Installer::ExtensionBuildError)

/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** 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=/usr/local/bin/ruby
  --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-sqlite3lib
  --without-sqlite3lib

Gem files will remain installed in /Users/richardmyers/.bundler/tmp/
436/gems/sqlite3-ruby-1.3.2 for inspection.
Results logged to /Users/richardmyers/.bundler/tmp/436/gems/sqlite3-
ruby-1.3.2/ext/sqlite3/gem_make.out
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in
`each'
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:446:in
`build_extensions'
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:198:in
`install'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
source.rb:95:in `install'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
installer.rb:55:in `run'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
spec_set.rb:12:in `each'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
spec_set.rb:12:in `each'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
installer.rb:44:in `run'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
installer.rb:8:in `install'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
cli.rb:225:in `install'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
vendor/thor/task.rb:22:in `send'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
vendor/thor/task.rb:22:in `run'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
vendor/thor/invocation.rb:118:in `invoke_task'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
vendor/thor.rb:246:in `dispatch'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/lib/bundler/
vendor/thor/base.rb:389:in `start'
  from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.7/bin/bundle:13
  from /usr/local/bin/bundle:19:in `load'
  from /usr/local/bin/bundle:19

mkmf.log:

find_header: checking for sqlite3.h... -------------------- yes

"gcc -E -I. -I/usr/local/lib/ruby/1.8/powerpc-darwin9.8.0 -I. -I/usr/
local/include -I/opt/local/include -I/sw/local/include -I/usr/include
-D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE=1 -fno-common -
pipe -fno-common conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <sqlite3.h>
/* end */

hello all,
this is driving me crazy, and i have tried everything and looked
everywhere and i cannot resolve this problem.

when i do bundle install in a rails app, i get an error "Failed to
build gem native extension" during sqlite3. i have included the entire
error below.
i have rails 3.0.3, ruby 1.8.7, and sqlite3 installed (although i cant

Do you have sqlite3 3.6.16 as the error message asks? If you aren't
fussy you could install an earlier version of sqlite3-ruby (that is
happy with the version you do have)

Fred

Frederick Cheung wrote in post #971035:

hello all,
this is driving me crazy, and i have tried everything and looked
everywhere and i cannot resolve this problem.

when i do bundle install in a rails app, i get an error "Failed to
build gem native extension" during sqlite3. i have included the entire
error below.
i have rails 3.0.3, ruby 1.8.7, and sqlite3 installed (although i cant

Do you have sqlite3 3.6.16 as the error message asks? If you aren't
fussy you could install an earlier version of sqlite3-ruby (that is
happy with the version you do have)

As an indication, this is the version I see on Ubuntu 10.04
(version 3.6.22 which is higher than the required 3.6.16).

peterv@ASUS:~$ dpkg -l 'sqlite*'
Desired=Unknown/Install/Remove/Purge/Hold

Peter Vandenabeele wrote in post #971136:

Frederick Cheung wrote in post #971035:

hello all,
this is driving me crazy, and i have tried everything and looked
everywhere and i cannot resolve this problem.

when i do bundle install in a rails app, i get an error "Failed to
build gem native extension" during sqlite3. i have included the entire
error below.
i have rails 3.0.3, ruby 1.8.7, and sqlite3 installed (although i cant

Do you have sqlite3 3.6.16 as the error message asks? If you aren't
fussy you could install an earlier version of sqlite3-ruby (that is
happy with the version you do have)

As an indication, this is the version I see on Ubuntu 10.04
(version 3.6.22 which is higher than the required 3.6.16).

peterv@ASUS:~$ dpkg -l 'sqlite*'
Desired=Unknown/Install/Remove/Purge/Hold
> Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
>/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
>>/ Name Version Description
+++-==============-==============-============================================
ii sqlite3 3.6.22-1 A command line interface for SQLite 3
un sqlite3-doc <none> (no description available)

Sorry for replying to my own post.

For completeness: you probably also need the libsqlite3-* and related
-dev packages, so below is a better list of relevant sqlite3 packages I
have installed here (on Ubuntu 10.04).

On which Operating System do you see this problem ?

peterv@ASUS:~$ dpkg -l '*sqlite*' | grep ^ii
ii libdbd-sqlite3-perl 1.29-1
Perl DBI driver with a self-contained RDBMS
ii libmono-sqlite2.0-cil 2.4.4~svn151842-1ubuntu4
Mono Sqlite library (for CLI 2.0)
ii libsqlite0 2.8.17-6build2
SQLite shared library
ii libsqlite3-0 3.6.22-1
SQLite 3 shared library
ii libsqlite3-dev 3.6.22-1
SQLite 3 development files
ii libsqlite3-ruby 1.2.4-2.1
SQLite3 interface for Ruby
ii libsqlite3-ruby1.8 1.2.4-2.1
SQLite3 interface for Ruby 1.8
ii sqlite3 3.6.22-1
A command line interface for SQLite 3

HTH,

Peter

Hey Peter,

Now I am for from pro, but had to reinstall my whole system and have had
a hell of a time getting ruby back to were it was.

I ran into some sqlite3 problems

after re installing ruby and then installing ruby 1.8.7 I re installed
sqlite3

gem install sqlite3-ruby (I'm a windows guy)

I still had to go out and actually down load sqlite-dll-win32.zip from
the sqlite home site.... unzip it and then manual put the sqlite3.dll
file in my ruby1.8.7/bin folder

now my sqlite3 runs fine. Hope this helps.

Cameron

Peter Vandenabeele wrote in post #971137:

in on mac os 10.5 - when i run sqlite3 -version i get 3.4.0 - so i
guess i thought i updated, but maybe not.
should i be concerned about this version or the sqlite3-ruby version?
i cant seem to figure out my sqlite3-ruby version, anyone know how on
mac os?
i also have libsqlite3 in my bin, this didnt seem to resolve anything.
another problem may be that i dont think sqlite3 was updated for PPC
machines, but again, this was working before, so i am perplexed.

in on mac os 10.5 - when i run sqlite3 -version i get 3.4.0 - so i
guess i thought i updated, but maybe not.
should i be concerned about this version or the sqlite3-ruby version?
i cant seem to figure out my sqlite3-ruby version, anyone know how on
mac os?
i also have libsqlite3 in my bin, this didnt seem to resolve anything.
another problem may be that i dont think sqlite3 was updated for PPC
machines, but again, this was working before, so i am perplexed.

Older versions of sqlite-ruby didn't require 3.6.16. You could try
installing an older version of the gem (with the --version option) or
install a newer version of sqlite yourself.

Fred

Hi all,
solution always depends on your OS and on versions.

The best is RVM http://rvm.beginrescueend.com/ allows you prevent
problems. It has also great packages which helps you with other
problems, and future upgrades will be easier.

On Win I think there isn't RVM but pik is available, never tried to be
honest.

If you can't see sqlite in your gem list, it's a problem. Then you
have to install it with "gem install sqlite3-ruby". On Ruby1.8 with
Ubuntu you also need other packages: libsqlite3, libsqlite3-dev,
please check all libsqlite in Synaptic.

(I think it's installed by default with Ruby1.9 and on MacOS, and OSX
or Win you may need other packages installed, I'm not sure about
these, sorry.)

If you still can't see it after install, then you must have gem
version problems. It's wise to have Ruby 1.9+Gem1.3.7 or
Ruby1.8+Gem1.3.5, I suggest updated. Before on mailing list others
solved it by completely reinstalling Rubygems, since they upgraded
Ruby, but gem dependencies remained.

If you have right Ruby, Gem, Sqlite3 gem installed, then you can run
bundle install.

Also check:
http://stackoverflow.com/search?q=sqlite3+gem

If you still have problems, ask me in private, and if you could solve
your problem, list it here, because others may be interested later.
cheers,
Zoli

thanks, zoli, installing rvm actually resolved the problem out of the
box, which is very strange. I don't know the ins and puts of RVM, but
i guess it comes with some packaged gems including sqlite? anyway, I
still want to resolve the problem on my default install, I will update
when I have some progress. than you everyone for your help.