Rails:Gem :: Ext :: BuildError:错误:无法构建gem原生扩展

时间:2017-11-17 01:23:21

标签: ruby-on-rails ruby rubygems

我在尝试克隆回购并启动并运行时遇到了问题。  当我运行bundler时遇到以下错误。出于某种原因,它不喜欢gem pg_query。在错误消息中,我看到:error: '__int128' is not supported for this target但这超出了我的知识范围。我曾尝试阅读类似的帖子,但尚未找到可行的解决方案。

Fetching pg_query 0.11.4
Installing pg_query 0.11.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/vagrant/.rbenv/versions/2.3.0/bin/ruby extconf.rb
compiling src/pg_query.c
In file included from ./src/postgres/include/postgres.h:47:0,
                 from src/pg_query_internal.h:4,
                 from src/pg_query.c:2:
./src/postgres/include/c.h:298:9: error: '__int128' is not supported for this ta
./src/postgres/include/c.h:298:24: warning: type defaults to 'int' in declaratio
./src/postgres/include/c.h:299:18: error: '__int128' is not supported for this t
make: *** [src/pg_query.o] Error 1
cp: cannot create regular file `./../../spec/files/': No such file or directory
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling pg_query_ruby.c
pg_query_ruby.c: In function 'pg_query_ruby_parse':
pg_query_ruby.c:80:2: warning: ISO C90 forbids mixed declarations and code [-Wde
pg_query_ruby.c: In function 'pg_query_ruby_normalize':
pg_query_ruby.c:99:2: warning: ISO C90 forbids mixed declarations and code [-Wde
pg_query_ruby.c: In function 'pg_query_ruby_fingerprint':
pg_query_ruby.c:115:2: warning: ISO C90 forbids mixed declarations and code [-Wd
linking shared-object pg_query/pg_query.so
/usr/bin/ld: cannot find -lpg_query
collect2: ld returned 1 exit status
make: *** [pg_query.so] Error 1

make failed, exit code 2

Gem files will remain installed in /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/
Results logged to /home/vagrant/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extens

An error occurred while installing pg_query (0.11.4), and Bundler cannot continu
Make sure that `gem install pg_query -v '0.11.4'` succeeds before bundling.

我已尝试运行gem install pg_query -v '0.11.4'并获得相同的结果。

1 个答案:

答案 0 :(得分:0)

您好,问题在于您的捆绑版本。您的GemFile指定较低的捆绑器版本,但您的系统具有更高的捆绑器版本。 请将正确的Bundler版本与Gemfile.lock匹配,并安装旧版本的bundler。请尝试以下代码

gem install bundler -v '~> 1.15'
bundle _1.15_ install