Reputation: 90
In the setup phase of an app that generates random quotes every few minutes. (Could probably use a motivation quote myself right about now as I've been pulling my hair out on this one for a day!)
Using ruby 2.3.0p0, and upon running bundle install, I get the following error:
bundle install
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies...
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.8.2
Using atomic 1.1.14
Using tzinfo 0.3.38
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using mime-types 1.25.1
Using polyglot 0.3.3
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.1
Using bundler 1.12.5
Using chronic 0.10.2
Using coffee-script-source 1.6.3
Using execjs 2.0.2
Using thor 0.18.1
Using flickraw 0.9.7
Using hike 1.2.3
Installing json 1.8.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160803-40268-tnpkzj.rb extconf.rb --use-system-libraries
creating Makefile
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function ‘fbuffer_to_s’:
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast [enabled by default]
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/json-1.8.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/json-1.8.1/gem_make.out
Using pg 0.17.1
Using tilt 1.4.1
Using rails_serve_static_assets 0.0.2
Using rails_stdout_logging 0.0.3
Using sass 3.2.13
Installing sqlite3 1.3.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8/ext/sqlite3
/usr/local/rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160803-40268-16a4yjy.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
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.8/mkmf.log
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8/ext/sqlite3
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8/ext/sqlite3
make "DESTDIR="
compiling backup.c
compiling statement.c
statement.c: In function ‘bind_param’:
statement.c:261:7: warning: implicit declaration of function ‘RBIGNUM’ [-Wimplicit-function-declaration]
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
In file included from statement.c:1:0:
./sqlite3_ruby.h:16:34: error: invalid type argument of ‘->’ (have ‘int’)
#define RBIGNUM_LEN(x) RBIGNUM(x)->len
^
statement.c:261:11: note: in expansion of macro ‘RBIGNUM_LEN’
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
statement.c:261:32: error: ‘SIZEOF_BDIGITS’ undeclared (first use in this function)
if (RBIGNUM_LEN(value) * SIZEOF_BDIGITS <= 8) {
^
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]
int status;
^
statement.c: In function ‘clear_bindings’:
statement.c:313:7: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
int status;
^
make: *** [statement.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.3.0/gems/sqlite3-1.3.8 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.8/gem_make.out
Using will_paginate 3.0.5
Using thread_safe 0.1.3
Using rack-test 0.6.2
Using treetop 1.4.15
Using coffee-script 2.2.0
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
I've taken some advice after research on similar issues from others and tried updating json by using 'bundle update json' and am still getting the same issue.
Here is the gemfile:
source 'https://rubygems.org'
#ruby "2.1.0"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use sqlite3 as the database for Active Record
group :development do
gem 'sqlite3'
end
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails', '~> 3.0.4'
#Gem for Heroku and PostgreSQL
group :production, :staging do
gem 'rails_12factor'
gem 'pg'
end
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
# Used for Flickr
gem 'flickraw'
#Used for writing and deploying cron jobs
gem 'whenever', :require => false
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
#Use will-paginate for pagination
gem 'will_paginate', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
This idea is originally from the following github project (https://github.com/Lieke22/Quotes.git) which I will be modifying to practice creating a rails web app.
I would greatly appreciate any feedback, pointers.
Best, Brinder
Upvotes: 0
Views: 847
Reputation: 371
At First you should try
$ sudo gem install json -v '1.8.1'
In case if that didn't work, you could do this:
$ sudo apt-get install ruby-dev
and then you could install the gem and continue. Hope that can be fixed by:
$ sudo apt-get install libsqlite3-dev
Upvotes: 1
Reputation: 38
Sounds like you need the tools to build native gems.
Try installing 'ruby-dev' with your package manager.
Upvotes: 1