Я новичок в ruby и столкнулся, когда пытался gem install pg
и получил эту проблему
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
Я проверил файл журнала, и он показывает, как это
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 */
Я уже установил postgresql по
sudo apt install linuxbrew-wrapper
sudo apt-get install build-essential
sudo apt-get install libpq-dev
brew install postgresql
Вот что я сделал для этой проблемы после поиска других заметок.Может кто-нибудь помочь мне здесь?Я проверил все возможные дубликаты, и вышеприведенные команды взяты из этих ответов.Тем не менее, моя Ubuntu по-прежнему жалуется на те же проблемы.