9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PostgreSQLを使ったRailsアプリケーションをwerckerでbuildしてたらlibruby.soでLoadErrorが出た。

Posted at

postgresqlを使ってbuildしようとしたらエラーが出た。

##結論
結論から先に言うと、

box: wercker/rvm

RVM使えって話っぽい。

##詳細
こんな感じの wercker.yml で、

wercker.yml
box: wercker/ubuntu12.04-ruby2.0.0
services:
    - wercker/postgresql
build:
    steps:
        - bundle-install
        - rails-database-yml:
            service: postgresql

        - script:
            name: echo ruby information
            code: |
                echo "ruby version $(ruby --version) running"
                echo "from location $(which ruby)"
                echo -p "gem list: $(gem list)"

        - script:
            name: Set up db
            code: bundle exec rake db:schema:load RAILS_ENV=test

        - script:
            name: rspec
            code: bundle exec rspec

Set up dbのところでエラー。

cd $WERCKER_SOURCE_DIR
$ export WERCKER_STEP_ROOT="/wercker/steps/wercker/script/0.0.0"
$ export WERCKER_STEP_ID="162fb6ee-500d-4ef8-8de7-47a3f945dcc2"
$ export WERCKER_STEP_NAME="script"
$ export WERCKER_REPORT_NUMBERS_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/numbers.ini"
$ export WERCKER_REPORT_MESSAGE_FILE="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/message.txt"
$ export WERCKER_REPORT_ARTIFACTS_DIR="$WERCKER_REPORT_DIR/$WERCKER_STEP_ID/artifacts"
$ mkdir -p $WERCKER_REPORT_ARTIFACTS_DIR
$ export WERCKER_STEP_TEMP="/tmp/$WERCKER_STEP_ID"
$ source '/wercker/wercker-build-essentials/init.sh'
$ mkdir -p $WERCKER_STEP_TEMP
$ bundle exec rake db:schema:load RAILS_ENV=test
rake aborted!
LoadError: libruby.so.2.0: cannot open shared object file: No such file or directory - /cache/bundle-install/ruby/2.0.0/gems/pg-0.17.1/lib/pg_ext.so
/cache/bundle-install/ruby/2.0.0/gems/pg-0.17.1/lib/pg.rb:4:in `require'
/cache/bundle-install/ruby/2.0.0/gems/pg-0.17.1/lib/pg.rb:4:in `<top (required)>'
/pipeline/build/config/application.rb:14:in `<top (required)>'
/pipeline/build/Rakefile:4:in `require'
/pipeline/build/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

rvmを使うことにして、

box: wercker/rvm

ってやったら動いた。

あ、ちゃんとバージョンも指定しよう。

    steps:
        - rvm-use:
            version: 2.1.2
        - bundle-install
        - #以下同様...
9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?