Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展 [英] Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension

查看:224
本文介绍了Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了提供一些背景知识 - 我刚刚从GitHub下载了一个Git Repo,为了一个朋友的应用程序,我试图从我的Mac('rails s')启动它。但是,我遇到以下错误//请参阅下文//运行捆绑安装时。看起来好像'pg'(postgreSQL)gem有某种模糊的安装错误。任何帮助将不胜感激!

To provide some background - I've just downloaded a Git Repo from GitHub, for a friends app and I am attempting to launch it from my Mac ('rails s'). However, I am being hit with the following error // see below // when running 'bundle install'. It seems as if the 'pg' (postgreSQL) gem is having some sort of obscure installation error. Any help would be appreciated!

$ gem install pg - - --with-pg-config = / usr / bin / pg_config /

$gem install pg -- --with-pg-config= /usr/bin/pg_config/

Installing pg (0.15.0) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb 
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... yes
checking for PQisthreadsafe()... yes
checking for PQprepare()... yes
checking for PQexecParams()... yes
checking for PQescapeString()... yes
checking for PQescapeStringConn()... yes
checking for PQescapeLiteral()... yes
checking for PQescapeIdentifier()... yes
checking for PQgetCancel()... yes
checking for lo_create()... yes
checking for pg_encoding_to_char()... yes
checking for pg_char_to_encoding()... yes
checking for PQsetClientEncoding()... yes
checking for PQlibVersion()... yes
checking for PQping()... yes
checking for PQsetSingleRowMode()... no
checking for rb_encdb_alias()... yes
checking for rb_enc_alias()... no
checking for rb_thread_call_without_gvl()... yes
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_fd_select()... yes
checking for rb_w32_wrap_io_handle()... no
checking for PGRES_COPY_BOTH in libpq-fe.h... no
checking for PGRES_SINGLE_TUPLE in libpq-fe.h... no
checking for struct pgNotify.extra in libpq-fe.h... yes
checking for unistd.h... yes
checking for ruby/st.h... yes
creating extconf.h
creating Makefile

make
compiling gvl_wrappers.c
compiling pg.c
pg.c: In function ‘Init_pg_ext’:
pg.c:384: error: ‘PQPING_OK’ undeclared (first use in this function)
pg.c:384: error: (Each undeclared identifier is reported only once
pg.c:384: error: for each function it appears in.)
pg.c:386: error: ‘PQPING_REJECT’ undeclared (first use in this function)
pg.c:388: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function)
pg.c:390: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function)
make: *** [pg.o] Error 1


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.15.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/pg-0.15.0/ext/gem_make.out
An error occured while installing pg (0.15.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.15.0'` succeeds before bundling.



GemFile



GemFile

source 'https://rubygems.org'

gem 'rails', '3.2.11'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'pg'
gem 'json'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'devise'

gem 'rails-backbone'

gem 'nokogiri'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug'


推荐答案

在Debian系统上,您必须安装libpq-dev包才能使用postgres在远程服务器上使用'pg'宝石。

On Debian systems you have to install libpq-dev package in order to use postgres on a distant server with 'pg' gem.

这篇关于Gem :: Installer :: ExtensionBuildError:错误:无法构建gem本机扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆