Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展Linux Mint

时间:2015-03-14 14:51:01

标签: ruby ruby-on-rails-4 heroku rubygems bundler

运行bundle install时遇到以下错误。 在Linux Mint 17.0上运行 Rails 4.0.2

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/home/dubzero/.rvm/rubies/ruby-2.0.0-p643/bin/ruby extconf.rb 
checking for ffi_call() in -lffi... yes
checking for ffi_prep_closure()... yes
checking for ffi_raw_call()... yes
checking for ffi_prep_raw_closure()... yes
checking for rb_thread_blocking_region()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
checking for ffi_prep_cif_var()... yes
creating extconf.h
creating Makefile

make "DESTDIR="
compiling LastError.c
compiling Type.c
compiling ClosurePool.c
compiling MemoryPointer.c
compiling DataConverter.c
compiling DynamicLibrary.c
compiling FunctionInfo.c
compiling StructByReference.c
compiling Buffer.c
compiling Types.c
compiling Platform.c
compiling ffi.c
compiling Function.c
compiling Thread.c
compiling LongDouble.c
compiling Struct.c
compiling Variadic.c
compiling Call.c
Call.c: In function ‘rbffi_SetupCallParams’:
Call.c:206:28: error: ‘UINT32_ADJ’ undeclared (first use in this function)
                 ADJ(param, UINT32);
                            ^
Call.c:83:58: note: in definition of macro ‘ADJ’
 #  define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ))
                                                          ^
Call.c:206:28: note: each undeclared identifier is reported only once for each function it appears in
                 ADJ(param, UINT32);
                            ^
Call.c:83:58: note: in definition of macro ‘ADJ’
 #  define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ))
                                                          ^
Call.c:230:28: error: ‘UINT64_ADJ’ undeclared (first use in this function)
                 ADJ(param, UINT64);
                            ^
Call.c:83:58: note: in definition of macro ‘ADJ’
 #  define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ))
                                                          ^
make: *** [Call.o] Ошибка 1


Gem files will remain installed in /home/dubzero/.rvm/gems/ruby-2.0.0-p643@railstutorial_rails_4_0/gems/ffi-1.9.7 for inspection.
Results logged to /home/dubzero/.rvm/gems/ruby-2.0.0-p643@railstutorial_rails_4_0/gems/ffi-1.9.7/ext/ffi_c/gem_make.out
An error occurred while installing ffi (1.9.7), and Bundler cannot continue.
Make sure that `gem install ffi -v '1.9.7'` succeeds before bundling.

的Gemfile

source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.0.2'

group :development, :test do
  gem 'sqlite3', '1.3.8'
  gem 'rspec-rails', '2.13.1'
end

group :test do
  gem 'selenium-webdriver', '2.35.1'
  gem 'capybara', '2.1.0'
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'

group :doc do
  gem 'sdoc', '0.3.20', require: false
end

group :production do
  gem 'pg', '0.15.1'
  gem 'rails_12factor', '0.0.2'
end

有什么想法吗? 提前谢谢

1 个答案:

答案 0 :(得分:1)

尝试使用旧版ffi。例如,在你的Gemfile中,输入:

gem 'ffi', '1.9.3'