0

I am new to ruby and encounter when I was trying to gem install pg and get this problem

Building native extensions with: '--with-pg-lib=/usr/lib'
This could take a while...
ERROR:  Error installing pg:
ERROR: Failed to build gem native extension.
checking for pg_config... yes
Using config values from /home/linuxbrew/.linuxbrew/bin/pg_config
checking for libpq-fe.h... *** 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=/home/chensiyuan/.rbenv/versions/2.5.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=${pg-dir}/lib

I have checked the log file and it shows like this

gcc: error: unrecognized command line option '-Wmisleading-indentation'
gcc: error: unrecognized command line option '-Wimplicit-fallthrough=0'
gcc: error: unrecognized command line option '-Wduplicated-cond'
gcc: error: unrecognized command line option '-Wrestrict'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

I have already installed the postgresql by

sudo apt install linuxbrew-wrapper

sudo apt-get install build-essential

sudo apt-get install libpq-dev

brew install postgresql

That's what I have done for this problem after I searched other notes. Can someone please help me out here? I have checked all the possible duplicate and the above commmands are from those answers. However, my ubuntu still complains about the same issues.

1 Answers1

1

If your brew install postgresql was installed successfully installed, then try bundle install in the ruby app again.