【发布时间】:2019-03-24 20:31:43
【问题描述】:
我是 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 */
我已经通过
安装了 postgresqlsudo apt install linuxbrew-wrapper
sudo apt-get install build-essential
sudo apt-get install libpq-dev
brew install postgresql
这是我在搜索其他笔记后针对这个问题所做的。有人可以帮我吗?我已经检查了所有可能的重复项,上述命令来自这些答案。但是,我的 ubuntu 仍然抱怨同样的问题。
【问题讨论】:
-
缺少哪些文件?请显示错误信息
-
你有完整的 gcc 安装吗?从命令行运行
gcc --version时会说什么? -
当我输入 gcc --version 时,它显示
gcc (Homebrew gcc 5.5.0_4) 5.5.0。 -
我已经检查了这个问题,因为你可以看到我已经尝试过这个可能重复的所有命令。
标签: ruby-on-rails ruby postgresql ubuntu rubygems