1

While compiling bundle install, I got this error:

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

    /home/bartsabayton/.rvm/rubies/ruby-2.2.0-preview1/bin/ruby -r ./siteconf20150310-8631-16gdgvg.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()... yes
checking for sqlite3_enable_load_extension()... yes
checking for sqlite3_load_extension()... yes
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 statement.c
statement.c: In function ‘bind_param’:
statement.c:261:7: warning: implicit declaration of function ‘RBIGNUM’ [-Wimplicit-function-declaration]
statement.c:261:11: error: invalid type argument of ‘->’ (have ‘int’)
statement.c:261:32: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function)
statement.c:261:32: note: each undeclared identifier is reported only once for each function it appears in
statement.c: In function ‘reset_bang’:
statement.c:293:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
statement.c: In function ‘clear_bindings’:
statement.c:313:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
make: *** [statement.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/bartsabayton/.rvm/gems/ruby-2.2.0-preview1@e-law-landing/gems/sqlite3-1.3.8 for inspection.
Results logged to /home/bartsabayton/.rvm/gems/ruby-2.2.0-preview1@e-law-landing/extensions/x86-linux/2.2.0/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.

So I did gem install sqlite3 -v '1.3.8', but when doing this,

ERROR:  While executing gem ... (ArgumentError)
    IPv4 address expects 4 bytes but 1 bytes

I checked my rvm and,

RVM LIST:

bartsabayton@bartsabayton-All-Series:~/rails/landing$ rvm list

rvm rubies

   ruby-2.0.0-p0 [ i686 ]
   ruby-2.1.0 [ i686 ]
 * ruby-2.1.3 [ i686 ]
=> ruby-2.2.0-preview1 [ i686 ]

# => - current
# =* - current && default
#  * - default

I am using:

  • Ubuntu 12.04
  • Ruby 2.2.0preview1 (2014-09-17 trunk 47616) [i686-linux]

Please help. Need to fix it.

sawa
  • 165,429
  • 45
  • 277
  • 381
BartSabayton
  • 535
  • 1
  • 5
  • 15

2 Answers2

4

You are using Ruby 2.2.0 and this particular version of sqlite3 (1.3.8) doesn't work on it.

So, you should install a newer version of sqlite3.

You can try:

gem install sqlite3

And make sure you installed sqlite3 and sqlite-devel on your system.

Note: As Ismael noticed, you should also update Ruby.

PJ Bergeron
  • 2,788
  • 4
  • 25
  • 42
  • I would also suggest to update the ruby version. As the OP is using a preview version – Ismael Abreu Mar 10 '15 at 03:34
  • Ismael, I can't update my ruby version. We are not able to change because we have a protocol to follow. So I depend on 2.2.0 ruby version – BartSabayton Mar 10 '15 at 03:39
  • `gem install sqlite3` installed a new version, so it installed 1.3.10. But it didn't fixed. I also use 1.3.7 but same error again. – BartSabayton Mar 10 '15 at 03:40
  • And `sqlite3` and `sqlite-devel` are installed? – PJ Bergeron Mar 10 '15 at 03:41
  • Like this? `sudo apt-get install libsqlite3-dev` – BartSabayton Mar 10 '15 at 03:43
  • Yes, or sometimes it can be `libsqlite3-ruby` – PJ Bergeron Mar 10 '15 at 03:46
  • `Reading package lists... Done Building dependency tree Reading state information... Done libsqlite3-dev is already the newest version. sqlite3 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 136 not upgraded. ` – BartSabayton Mar 10 '15 at 03:46
  • `libsqlite3-dev` already installed. I also installed `libsqlite3-ruby` just now. Then, I bundle install again but I got same error. :( – BartSabayton Mar 10 '15 at 03:51
  • Sorry, no idea what's wrong. It would be better to update ruby. – PJ Bergeron Mar 10 '15 at 04:38
  • BartSabayton, The thing is that you are using a preview version of ruby-2.2.0 the final version came out on December so you should be able to use that version because that's the actual official 2.2.0 ruby version :) – Ismael Abreu Mar 10 '15 at 18:03
  • Also try this `gem install sqlite3 -- --with-sqlite3-include=/usr/include`. Taken from http://stackoverflow.com/questions/3458602/sqlite3-ruby-install-error-on-ubuntu – Ismael Abreu Mar 10 '15 at 18:08
0

You are using Ruby Higher versions like 2.x.x and this particular version of sqlite3 (1.3.8) have an issue.

so install sqlite3 manually using below command -

gem install sqlite3

and if still error you get delete your Gemfile.lock and then do bundle install, it works.

Sartaj Singh Sisodiya
  • 1,143
  • 12
  • 10