安装sqlite3时捆绑安装失败(1.3.8)

时间:2016-08-03 17:04:19

标签: ruby-on-rails rubygems

在每隔几分钟生成随机引号的应用的设置阶段。 (现在我可能正好使用动机报价,因为我已经把头发拉出来了一天!)

使用ruby 2.3.0p0,在运行bundle install时,我收到以下错误:

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.

我在研究过其他人的类似问题之后采取了一些建议,并尝试使用&#39;捆绑更新json&#39;来更新json。我仍然遇到同样的问题。

这是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]

这个想法最初来自以下github项目(https://github.com/Lieke22/Quotes.git),我将修改它以练习创建rails web应用程序。

我非常感谢任何反馈,指点。

最佳, Brinder

2 个答案:

答案 0 :(得分:1)

听起来你需要工具来构建原生宝石。

尝试安装&#39; ruby​​-dev&#39;与您的包管理器。

答案 1 :(得分:0)

首先你应该尝试

$ sudo gem install json -v&#39; 1.8.1&#39;

如果不起作用,你可以这样做:

$ sudo apt-get install ruby​​-dev

然后你可以安装gem并继续。希望可以通过以下方式修复:

$ sudo apt-get install libsqlite3-dev