【问题标题】:Cloudbees dev cloud + Postgresql + rubygems pg (native extension) how to use?Cloudbees dev cloud + Postgresql + ruby​​gems pg(原生扩展)怎么用?
【发布时间】:2013-06-12 17:43:38
【问题描述】:

我想在cloudbees dev cloud中使用postgres,我看了这篇文章: http://wiki.cloudbees.com/bin/view/DEV/PostgreSQL

但是,我运行bundle,我得到了错误:

正在安装 pg (0.15.1) .......

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native 扩展名。

    /usr/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 检查 libpq-fe.h... 否 找不到 'libpq-fe.h 标头 * extconf.rb failed * 由于某种原因无法创建 Makefile,可能缺少必要的库和/或头文件。查看 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}/ --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/usr/bin/ruby --with-pg --without-pg --with-pg-dir --without-pg-dir --with-pg-include --without-pg-include=${pg-dir}/include --with-pg-lib --without-pg-lib=${pg-dir}/ --with-pg-config --without-pg-config --with-pg_config --without-pg_config

Gem 文件将继续安装在 /home/jenkins/.gem/ruby/1.9.1/gems/pg-0.15.1 进行检查。结果 登录到 /home/jenkins/.gem/ruby/1.9.1/gems/pg-0.15.1/ext/gem_make.out 一个错误 安装 pg (0.15.1) 时发生,并且 Bundler 无法继续。 在捆绑之前确保gem install pg -v '0.15.1' 成功。

接下来我该怎么做?

【问题讨论】:

    标签: postgresql cloudbees pg


    【解决方案1】:

    有两种方法可以解决这个问题:

    1) 使用上述解决方法,添加

    PATH=/scratch/jenkins/postgresqls/postgresql-9.2.4-x86_64/bin:$PATH
    

    这并不理想,因为我们只是要移动该路径以支持拉取请求构建

    2) 结合两个步骤

    在您的构建中,您需要结合 PostgreSQL 和 Ruby 安装步骤,以便正确配置环境。

    我个人建议使用脚本进行构建 - ./bin/run-ci - 而不是将所有内容都输入 Jenkins。

    这可以使您的构建过程更改得到控制和记录 - 并让您可以非常快速地跨多个构建服务器推出更改。

    【讨论】:

      【解决方案2】:

      我使用单shell脚本,我在顶部声明一次:

      export POSTGRESQL_VERSION=9.2.4
      curl -s -o use-postgresql https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/postgresql/use-postgresql
      source ./use-postgresql
      

      那么我就不需要在 shell 之间传递环境变量了。

      【讨论】:

        【解决方案3】:

        我的解决方法:

        在bundle上面设置PATH,我的安装版本是9.2.4。

        PATH=/scratch/hudson/postgresqls/postgresql-9.2.4-x86_64/bin:$PATH

        然后我可以捆绑完成:)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-11-01
          • 1970-01-01
          • 1970-01-01
          • 2020-08-07
          • 1970-01-01
          • 2016-03-08
          • 2016-09-25
          • 1970-01-01
          相关资源
          最近更新 更多