gpt4 book ai didi

ruby-on-rails - 如何在 Ubuntu 上安装 Postgresql Gem

转载 作者:行者123 更新时间:2023-11-29 11:22:40 25 4
gpt4 key购买 nike

我在我的 Asus Chromebook 上通过 crouton 安装了 Ubuntu 12.04 Precise。我有一个需要 postgres 的 Rails 应用程序。当我运行“bundle”时,它无法安装 pg gem。我尝试独立安装它的多个版本,但都失败了。失败报告如下:

Building native extensions. This could take a while... ERROR: Error installing pg: ERROR: Failed to build gem native extension.

/home/oscar/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20150331-16650-11xjo0a.rb extconf.rb checking for

pg_config... 是 使用来自/usr/bin/pg_config 的配置值 你需要 安装 postgresql-server-dev-X.Y 以构建服务器端 用于构建客户端应用程序的扩展或 libpq-dev。你 需要安装 postgresql-server-dev-X.Y 来构建服务器端 用于构建客户端应用程序的扩展或 libpq-dev。 检查 libpq-fe.h... 否找不到“libpq-fe.h header ” * extconf.rb 失败 * 由于某种原因无法创建 Makefile,可能缺少必要的库和/或 header 。查看 mkmf.log 文件以获取更多详细信息。您可能需要配置 选项。

提供的配置选项: --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 --源目录=。 --curdir --ruby=/home/oscar/.rvm/rubies/ruby-1.9.3-p551/bin/ruby --with-pg --without-pg --enable-windows-cross --disable-windows-cross --with-pg-config --without-pg-config --with-pg_config --without-pg_config --with-pg-目录 --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/lib

extconf 失败,退出代码 1

Gem 文件将保留安装在 /home/oscar/.rvm/gems/ruby-1.9.3-p551/gems/pg-0.18.1 用于检查。 结果记录到 /home/oscar/.rvm/gems/ruby-1.9.3-p551/extensions/x86_64-linux/1.9.1/pg-0.18.1/gem_make.out

我还尝试使用 brew 安装它。文件已下载,似乎已安装,但当我运行“brew upgrade postgresql”时,它说 postgresql 没有退出。我完全没有想法,也找不到其他人解决我的问题。

最佳答案

据我所知,它说“你需要安装 postgresql-server-dev-X.Y 来构建服务器端扩展或 libpq-dev 来构建客户端应用程序”这意味着你需要在您的系统上安装软件包以使 gem 工作。

所以在 fedora 上我不得不 yum install postgresql-devel。既然你在 Ubuntu 上,我认为你需要做

sudo apt-get install libpq-dev

你可能还需要 build-essential 这样你就可以运行

sudo apt-get install libpq-dev build-essential

关于ruby-on-rails - 如何在 Ubuntu 上安装 Postgresql Gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29378159/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com