I’m new to Linux, and I just installed a distro korora based on fedora. I installed rails but when i try to create new project and write bundle install in the terminal i got this 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.
I don’t know what to do and I want to solve this problem as possible as I can.
Advertisement
Answer
You need to install the development pg library first.
yum install postgresql-devel
or if you’re using apt:
apt-get install libpq-dev
Then gem install pg -v '0.19.0'
.