2 votes

impossible d'installer la gemme pg dans ruby on rails

J'essaie d'installer la gemme 'pg' et j'obtiens l'erreur suivante :

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/thomas/.rvm/gems/ruby-2.7.1/gems/pg-1.2.3/ext
/usr/share/rvm/rubies/ruby-2.7.1/bin/ruby -I
/usr/share/rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0 -r
./siteconf20200423-27933-r303r1.rb 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/share/rvm/rubies/ruby-2.7.1/bin/$(RUBY_BASE_NAME)
    --with-pg
    --without-pg
    --enable-windows-cross
    --disable-windows-cross
    --with-pg-config
    --without-pg-config
    --with-pg_config
    --without-pg_config
    --with-pg-dir
    --without-pg-dir
    --with-pg-include
    --without-pg-include=${pg-dir}/include
    --with-pg-lib
    --without-pg-lib=${pg-dir}/lib

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/home/thomas/.rvm/gems/ruby-2.7.1/extensions/x86_64-linux/2.7.0/pg-1.2.3/mkmf.log

extconf failed, exit code 1

de nombreuses recherches sur le SO suggèrent

sudo apt-get install libpq-dev

mais cela donne

Err:1 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 libpq5 amd64 11.4-1.pgdg16.04+1
  404  Not Found [IP: 87.238.57.227 80]
Err:2 http://apt.postgresql.org/pub/repos/apt xenial-pgdg/main amd64 libpq-dev amd64 11.4-1.pgdg16.04+1
  404  Not Found [IP: 87.238.57.227 80]
E: Failed to fetch http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-11/libpq5_11.4-1.pgdg16.04+1_amd64.deb  404  Not Found [IP: 87.238.57.227 80]

E: Failed to fetch http://apt.postgresql.org/pub/repos/apt/pool/main/p/postgresql-11/libpq-dev_11.4-1.pgdg16.04+1_amd64.deb  404  Not Found [IP: 87.238.57.227 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

et en exécutant le programme suggéré

apt-get update --fix-missing

donne la même erreur que ci-dessus. Avez-vous des idées ? J'ai vu beaucoup de messages avec le même problème, proposant généralement des solutions similaires, mais elles ne semblent pas fonctionner ici. Merci d'avance

6voto

Denny Points 54
sudo apt-get install libpq-dev

Prograide.com

Prograide est une communauté de développeurs qui cherche à élargir la connaissance de la programmation au-delà de l'anglais.
Pour cela nous avons les plus grands doutes résolus en français et vous pouvez aussi poser vos propres questions ou résoudre celles des autres.

Powered by:

X