2012-10-26 9 views
37
$ sudo bundle install 

ErgebnisSchienen installieren pg - nicht die ‚libpq-fe.h Header

Fetching gem metadata from https://rubygems.org/........... 
Fetching gem metadata from https://rubygems.org/.. 
Using rake (0.9.2.2) 
Using i18n (0.6.1) 
Using multi_json (1.3.6) 
Using activesupport (3.2.8) 
Using builder (3.0.4) 
Using activemodel (3.2.8) 
Using erubis (2.7.0) 
Using journey (1.0.4) 
Using rack (1.4.1) 
Using rack-cache (1.2) 
Using rack-test (0.6.2) 
Using hike (1.2.1) 
Using tilt (1.3.3) 
Using sprockets (2.1.3) 
Using actionpack (3.2.8) 
Using mime-types (1.19) 
Using polyglot (0.3.3) 
Using treetop (1.4.11) 
Using mail (2.4.4) 
Using actionmailer (3.2.8) 
Using arel (3.0.2) 
Using tzinfo (0.3.33) 
Using activerecord (3.2.8) 
Using activeresource (3.2.8) 
Using bundler (1.2.1) 
Using coffee-script-source (1.4.0) 
Using execjs (1.4.0) 
Using coffee-script (2.2.0) 
Using rack-ssl (1.3.2) 
Using json (1.7.5) 
Using rdoc (3.12) 
Using thor (0.16.0) 
Using railties (3.2.8) 
Using coffee-rails (3.2.2) 
Using jquery-rails (2.1.3) 
Installing pg (0.14.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 

     /usr/bin/ruby1.8 extconf.rb 
checking for pg_config... yes 
Using config values from /usr/bin/pg_config 
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. 
You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application. 
checking for libpq-fe.h... no 
Can't find the 'libpq-fe.h header 
*** extconf.rb failed *** 
Could not create Makefile due to some reason, probably lack of 
necessary libraries and/or headers. Check the mkmf.log file for more 
details. You may need configuration options. 

Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/bin/ruby1.8 
    --with-pg 
    --without-pg 
    --with-pg-dir 
    --without-pg-dir 
    --with-pg-include 
    --without-pg-include=${pg-dir}/include 
    --with-pg-lib 
    --without-pg-lib=${pg-dir}/lib 
    --with-pg-config 
    --without-pg-config 
    --with-pg_config 
    --without-pg_config 

Gem files will remain installed in /var/lib/gems/1.8/gems/pg-0.14.1 for inspection. 
Results logged to /var/lib/gems/1.8/gems/pg-0.14.1/ext/gem_make.out 
An error occurred while installing pg (0.14.1), and Bundler cannot continue. 
Make sure that `gem install pg -v '0.14.1'` succeeds before bundling. 

gefunden bin ich $ gem install pg -v '0.14.1' machen Aber dies ist nicht helfen

Mein Gemfile

source 'https://rubygems.org' 

#gem 'rails', '3.0.9' 

#gem 'sqlite3', '1.3.6', :group => :development 


gem 'rails', '3.2.8' 

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


gem 'sqlite3' 
gem 'pg' 
gem 'taps' 

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' 


#group :production do 
    #gem 'pg' 
#end 
#group :development do 
    #gem 'sqlite3' 
#end 

gem_make.out

mkmf.log

find_executable: checking for pg_config... -------------------- yes 

-------------------- 

find_header: checking for libpq-fe.h... -------------------- no 

"gcc -E -I. -I/usr/lib/ruby/1.8/i686-linux -I. -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -I -fno-strict-aliasing -g -g -O2 -fPIC conftest.c -o conftest.i" 
conftest.c:1:22: fatal error: libpq-fe.h: No such file or directory 
compilation terminated. 
checked program was: 
/* begin */ 
1: #include <libpq-fe.h> 
/* end */ 

-------------------- 

Helfen Sie mir bitte. Vielen Dank.

Entschuldigung für diesen Text. Ihr Post hat nicht viel Kontext, um die Codeabschnitte zu erklären; Bitte erläutern Sie Ihr Szenario deutlicher.

+0

Wie haben Sie PostgreSQL installiert? – Stefan

+1

mögliches Duplikat von [Die PostgreSQL-Clientbibliothek (libpq) kann nicht gefunden werden (http: // stackoverflow.com/questions/6209797/cant-find-die-postgresql-client-library-libpq) – skolima

+0

mögliche duplikate von [Kann nicht die 'libpq-fe.h header beim versuchen, pg gem zu installieren] (http: // stackoverflow .com/questions/6040583/cant-find-the-libpq-fe-h-header-wenn-versuchen-zu-installieren-pg-gem) – iconoclast

Antwort

91

Nur stellen diese

$ sudo apt-get install libpq-dev 
+4

Dies tat es für mich +1 –

+5

Das hat es nicht für mich getan ... –

+0

Ich habe versucht, das auf Ubuntu 14.04 zu tun, aber es gab mir das: "libpq-dev: Hängt ab: libpq5 (= 9.3.4-1) aber 9.3.10-0ubuntu0.14.04 soll installiert werden" –

1

try this:

sudo apt-get install libpq-dev 
gem install pg 

wäre es Werke sein!

13

Try this:

  1. Gebräu postgresql installieren
  2. gem install pg
  3. Bündel
4

Unter Mac OS X wie folgt ausführen installieren:

gem install pg -- --with-pg-config=***/path/to/pg_config*** 

***/path/to/pg_config*** ist Pfad zu pg_confi g

11

auf Fedora/RHEL-Systemen hat dies den Trick:

sudo yum install libpqxx-devel 
+0

Warum heißt es: Kein Paket libpqxx-devel verfügbar. – itsji10dra

+1

yum liste libpq * gefolgt von yum install libpqxx-devel.x86_64 – erichfw

22

Das in Can't find the 'libpq-fe.h header when trying to install pg gem

beantwortet Je nach Umgebung:

  • Mac:brew install postgresql
  • Ubuntu:sudo apt-get install libpq-dev
  • RHEL: yum install postgresql-devel

Dann gem install pg laufen wieder

+0

Ich habe versucht, das auf Ubuntu 14.04 zu tun, aber es gab mir das: "libpq-dev: Hängt ab: libpq5 (= 9.3.4-1) aber 9.3.10- 0ubintu0.14.04 soll installiert werden " –

+0

Aber wenn ich versuche, libpq5 zu installieren, heißt es" libpq5 ist bereits die neueste Version. " Gleiches für PostgreSQL –

+0

PostgreSQL Version ist: psql - Version: psql (PostgreSQL) 9.3.10. PostgreSQL 9.3.10 auf x86_64-unknown-linux-gnu, kompiliert von gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2, 64-bit –

0

Das ist für mich gearbeitet:

sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config 
1

auf Mac stellen Sie sicher, Ihre Postgres verbunden ist. Sie können es tun, indem

brew link --overwrite postgresql 

Diese Fest das Problem für mich.

0

Ich hatte dieses Problem mit einem Jenkins-Server auf Amazon AMI.

$ pg_config | grep VERSION 
VERSION = PostgreSQL 9.4.9 

Dann je nachdem, welche Version Sie benötigen, können Sie die lib

erforderlich installieren
$ sudo yum list postgresql* | grep devel 
postgresql92-devel.x86_64    9.2.18-1.59.amzn1   @amzn-main 
postgresql94-devel.x86_64    9.4.9-1.67.amzn1   @amzn-main 
postgresql8-devel.x86_64    8.4.20-5.52.amzn1   amzn-main 
postgresql93-devel.x86_64    9.3.14-1.62.amzn1   amzn-main 
postgresql95-devel.x86_64    9.5.4-1.71.amzn1   amzn-main 

Dann können Sie einfach die entsprechende Version installieren, in meinem Fall für Version 9.4:

sudo yum install postgresql94-devel 
0

Ich benutze Ubuntu-16. Und ich verwende die Methode, die hier gezeigt wird: https://www.postgresql.org/download/linux/ubuntu/, um postgresql-9.6 zu installieren; Und ich verwende "sudo apt-get install libpq-dev", um die devlib zu installieren.Aber es kann immer noch nicht funktionieren. Also verwende ich die Methode ln, um eine weiche Verbindung herzustellen, hier ist es: sudo ln -s /usr/include/postgresql/libpq-fe.h /usr/include/; sudo ln -s /usr/include/postgresql/postgres_ext.h /usr/include/ Und ich löse das Problem endlich.

Verwandte Themen