$ Sudo bundle install
Ergebnis
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.
Ich mache $ gem install pg -v '0.14.1'
Aber das ist keine Hilfe
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
/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
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 */
--------------------
Hilf mir bitte. Vielen Dank.
Entschuldigung für diesen Text ... Ihr Beitrag enthält nicht viel Kontext, um die Codeabschnitte zu erläutern. Bitte erläutern Sie Ihr Szenario genauer.
Mach das einfach
$ Sudo apt-get install libpq-dev
Dies wird beantwortet in Kann den Header 'libpq-fe.h nicht finden, wenn versucht wird, pg gem zu installieren
Abhängig von Ihrer Umgebung:
brew install postgresql
Sudo apt-get install libpq-dev
yum install postgresql-devel
Führen Sie dann erneut gem install pg
aus
Versuche dies:
Auf Fedora/RHEL-Systemen hat dies den Ausschlag gegeben:
Sudo yum install libpqxx-devel
Unter Mac OS X laufen Sie so:
gem install pg -- --with-pg-config=***/path/to/pg_config***
***/path/to/pg_config***
ist der Pfad zu pg_config
Ich hatte dieses Problem mit einem Jenkins-Server auf Amazon AMI.
$ pg_config | grep VERSION
VERSION = PostgreSQL 9.4.9
Je nachdem, welche Version Sie benötigen, können Sie die erforderliche Bibliothek 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
Stellen Sie auf dem Mac sicher, dass Ihre Postgres verlinkt sind. Sie können es durch
brew link --overwrite postgresql
Dies hat das Problem für mich behoben.
versuche dies:
Sudo apt-get install libpq-dev
gem install pg
es würde funktionieren!
Für Amazon Linux:
Sudo yum install postgresql-devel
führen Sie dann Ihren Befehl erneut aus
brew install postgresql
Hat für mich gearbeitet.
Bei der Installation von postgresql ist ein weiterer Fehler aufgetreten
Error: The following directories are not writable by your user: /usr/local/lib/pkgconfig /usr/local/share/info /usr/local/share/man/man3
Dieser Fehler wurde behoben, indem dem aktuellen Benutzer Zugriff auf die genannten Verzeichnisse gewährt wurde
Sudo chown -R $(whoami) (path)
Ich benutze Ubuntu-16. Und ich benutze die hier gezeigte Methode: https://www.postgresql.org/download/linux/ubuntu/ um postgresql-9.6 zu installieren; Und ich benutze "Sudo apt-get install libpq-dev"
, um die devlib zu installieren. Aber es funktioniert immer noch nicht. Also verwende ich die Methode ln
, um einen Softlink 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/
Das hat für mich funktioniert:
Sudo gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config