错误:无法在 Arch (postgresql) 上构建 gem 本机扩展

错误:无法在 Arch (postgresql) 上构建 gem 本机扩展

gem pg由于错误,我无法在 Arch 上安装:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /home/alex/.rvm/rubies/ruby-2.1.1/bin/ruby 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}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/alex/.rvm/rubies/ruby-2.1.1/bin/ruby
    --with-pg
    --without-pg
    --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}/lib

extconf failed, exit code 1

Gem files will remain installed in /home/alex/.rvm/gems/ruby-2.1.1/gems/pg-0.17.1 for inspection.
Results logged to /home/alex/.rvm/gems/ruby-2.1.1/extensions/x86_64-linux/2.1.0/pg-0.17.1/gem_make.out

即使这样我还是安装了sudo pacman -S libmariadbclient。我在 Ubuntu 上遇到了这个错误,但是我可以通过安装 pgdev (我不太记得了)库来解决它。事实是,这个库在其存储库中不存在用于 arch,或者它的调用方式不同。

答案1

sudo pacman -S postgresql-libs

答案2

正如所提到的@克雷格·林格,搜索包含“libpq-fe.h”的包。我使用 pkgfile 来实现:

pacman -S pkgfile
pkgfile --update
pkgfile --search libpq-fe.h

返回“postgresql-libs”。安装该软件包,如@inn0kenty所述。

我刚刚遇到了同样的问题,我使用这些步骤解决了它。

相关内容