Soy nuevo en Linux y acabo de instalar una distro korora basada en fedora. Instalé rieles pero cuando intento crear un nuevo proyecto y escribir la instalación del paquete en la terminal, recibí este error

Fetching gem metadata from https://rubygems.org/..............
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 12.0.0
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
Using minitest 5.10.1
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using rack 2.0.1
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.4
Using bundler 1.13.6
Using byebug 9.0.6
Using ffi 1.9.14
Using rb-fsevent 0.9.8
Using method_source 0.8.2
Installing pg 0.19.0 with native extensions
Using puma 3.6.2
Using thor 0.19.4
Using tzinfo 1.2.2
Using nokogiri 1.6.8.1
Using rack-test 0.6.3
Using sprockets 3.7.0
Using websocket-driver 0.6.4
Using mime-types 3.1
Using rb-inotify 0.9.7
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/myusername/.gem/ruby/gems/pg-0.19.0/ext
/usr/bin/ruby -r ./siteconf20161213-11986-1jtdscv.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
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}/lib64
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/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}/lib64

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

  /home/myusername/.gem/ruby/extensions/x86_64-linux/2.3.0/pg-0.19.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/myusername/.gem/ruby/gems/pg-0.19.0 for inspection.
Results logged to /home/myusername/.gem/ruby/extensions/x86_64-linux/2.3.0/pg-0.19.0/gem_make.out

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

No sé qué hacer y quiero resolver este problema lo más posible.

0
id3vz 13 dic. 2016 a las 13:16

2 respuestas

La mejor respuesta

Primero debe instalar la biblioteca pg de desarrollo.

yum install postgresql-devel

O si estás usando apt:

apt-get install libpq-dev

Entonces gem install pg -v '0.19.0'.

3
luckyruby 13 dic. 2016 a las 10:42

Probar con:

sudo dnf install libpq-devel

Entonces:

gem install pg

O:

bundle install

Me funciona con Rails 5.2 en Fedora 30

0
Daniel Martínez Sarta 24 sep. 2019 a las 15:06