Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Tom Finet
Tom Finet
7,027 Points

Cannot install sqlite3 gem for Odot rails application

I am trying to run the bundle command to install all the gems the Odot application since I have downloaded the project files. All gems have downloaded without a problem but the sqlite3 gem has not. I have no idea what the following means could somebody please explain what is going on and how to fix?

Installing sqlite3 1.3.8 with native extensions

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

/Users/tomfinet/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151208-

2023-1esrcfp.rb extconf.rb checking for sqlite3.h... yes checking for sqlite3_libversion_number() in -lsqlite3... yes checking for rb_proc_arity()... yes checking for sqlite3_initialize()... yes checking for sqlite3_backup_init()... yes checking for sqlite3_column_database_name()... no checking for sqlite3_enable_load_extension()... no checking for sqlite3_load_extension()... no checking for sqlite3_open_v2()... yes checking for sqlite3_prepare_v2()... yes checking for sqlite3_int64 in sqlite3.h... yes checking for sqlite3_uint64 in sqlite3.h... yes creating Makefile

make "DESTDIR=" clean

make "DESTDIR=" compiling backup.c compiling database.c compiling exception.c compiling sqlite3.c compiling statement.c statement.c:261:11: warning: implicit declaration of function 'RBIGNUM' is invalid in C99 [-Wimplicit-function-declaration] if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ ./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN'

define RBIGNUM_LEN(x) RBIGNUM(x)->len

                   ^

statement.c:261:11: error: member reference type 'int' is not a pointer if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^~~~~~~~~~~~~~~~~~ ./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN'

define RBIGNUM_LEN(x) RBIGNUM(x)->len

                   ~~~~~~~~~~  ^

statement.c:261:32: error: use of undeclared identifier 'SIZEOF_BDIGITS' if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ 1 warning and 2 errors generated. make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/tomfinet/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.8 for inspection. Results logged to /Users/tomfinet/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/sqlite3-1.3.8/gem_make.out An error occurred while installing sqlite3 (1.3.8), and Bundler cannot continue. Make sure that gem install sqlite3 -v '1.3.8' succeeds before bundling.

What is the problem and how do I fix it? Thanks.

What message do you get when you

gem install sqlite3 -v '1.3.8'

Not 100% sure on why the bundler is not working here, but that's what the error message suggested.

Tom Finet
Tom Finet
7,027 Points

This what happens, looks very similar to the bundle command result.

Toms-MacBook-Air:odot-69450858b2a53099cbc4ee08fd2c18716560d7fa 2 tomfinet$ gem install sqlite3 -v '1.3.8' Building native extensions. This could take a while... ERROR: Error installing sqlite3: ERROR: Failed to build gem native extension.

/Users/tomfinet/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20151208-2314-yvsn75.rb extconf.rb

checking for sqlite3.h... yes checking for sqlite3_libversion_number() in -lsqlite3... yes checking for rb_proc_arity()... yes checking for sqlite3_initialize()... yes checking for sqlite3_backup_init()... yes checking for sqlite3_column_database_name()... no checking for sqlite3_enable_load_extension()... no checking for sqlite3_load_extension()... no checking for sqlite3_open_v2()... yes checking for sqlite3_prepare_v2()... yes checking for sqlite3_int64 in sqlite3.h... yes checking for sqlite3_uint64 in sqlite3.h... yes creating Makefile

make "DESTDIR=" clean

make "DESTDIR=" compiling backup.c compiling database.c compiling exception.c compiling sqlite3.c compiling statement.c statement.c:261:11: warning: implicit declaration of function 'RBIGNUM' is invalid in C99 [-Wimplicit-function-declaration] if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ ./sqlite3_ruby.h:16:24: note: expanded from macro 'RBIGNUM_LEN'

define RBIGNUM_LEN(x) RBIGNUM(x)->len

                   ^

statement.c:261:11: error: member reference type 'int' is not a pointer if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^~~~~~~~~~~~~~~~~~ ./sqlite3_ruby.h:16:36: note: expanded from macro 'RBIGNUM_LEN'

define RBIGNUM_LEN(x) RBIGNUM(x)->len

                   ~~~~~~~~~~  ^

statement.c:261:32: error: use of undeclared identifier 'SIZEOF_BDIGITS' if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) { ^ 1 warning and 2 errors generated. make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/tomfinet/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.8 for inspection. Results logged to /Users/tomfinet/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/sqlite3-1.3.8/gem_make.out

1 Answer

I've had something similar to this happen to me. There were a few things that needed changing to get it to work. I found this stackoverflow which has some ideas. Here's what worked for me:

http://stackoverflow.com/questions/5025680/sqlite3-gem-fails-to-install

First, make sure you have XCode installed on your macbook air. This may fix the issue. If it doesn't we may need to

'gem install bundler'

for the version of Ruby that you have running on this application. If you change any executables, you may also need to

'rbenv rehash'

Tom Finet
Tom Finet
7,027 Points

Thank you for the help, you have solved my problem. Thanks a bunch!

No problem, Sarah! Can you mark the answer above as the correct answer? It helps me to earn points with Treehouse and also helps other people find help to the same problem.