LoadError: Didn't find libzbar on your system


#1

Using the getting started template.

In steps I added

  • run: sudo apt-get install libzbar0

I get the following error:

LoadError: Didn't find libzbar on your system
Searched in "/{opt,usr}/{,local/}lib{,64}/{,x86_64-linux-gnu/,i386-linux-gnu/}libzbar.{dylib,so*}"
Please install zbar (http://zbar.sourceforge.net/) or set ZBAR_LIB if it's in a weird place
FFI::Library::ffi_lib() failed with error: Could not open library 'vendor/lib/libzbar.so': vendor/lib/libzbar.so: cannot open shared object file: No such file or directory

I feel like I’m missing a circleci config setting.

Can I add to the build in the config.yml or do I need a customized docker build?

config.yml:

# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
  build:
    docker:
      # specify the version you desire here
       - image: circleci/ruby:2.4.3-node-browsers
         environment:
           PGHOST: 127.0.0.1
           PGUSER: circleci-demo-ruby
           RAILS_ENV: test
           ZBAR_LIB: vendor/lib/libzbar.so

      # Specify service dependencies here if necessary
      # CircleCI maintains a library of pre-built images
      # documented at https://circleci.com/docs/2.0/circleci-images/
      # The following example uses the official postgres 9.6 image, you may also use circleci/postgres:9.6
      # which includes a few enhancements and modifications. It is possible to use either image.
       - image: postgres:9.6
         environment:
           POSTGRES_USER: circleci-demo-ruby
           POSTGRES_DB: milner-crm
           POSTGRES_PASSWORD: ""
           ZBAR_LIB: vendor/lib/libzbar.so

    working_directory: ~/repo

    steps:
      - checkout

      # Add ZBAR
      - run: sudo apt-get install libzbar0

      # Which version of bundler?
      - run:
          name: Which bundler?
          command: bundle -v

      # Download and cache dependencies
      - restore_cache:
          keys:
          - gem-cache-{{ checksum "Gemfile.lock" }}
          # fallback to using the latest cache if no exact match is found
          - gem-cache-

      - run:
          name: install dependencies
          command: |
            bundle check || bundle install --jobs=4 --retry=3 --path vendor/bundle

      - save_cache:
          paths:
            - ./vendor/bundle
          key: gem-cache-{{ checksum "Gemfile.lock" }}

            # Only necessary if app uses webpacker or yarn in some other way
      - restore_cache:
          keys:
            - yarn-cache-{{ checksum "yarn.lock" }}
            - yarn-cache-

      - run:
          name: Yarn Install
          command: yarn install --cache-folder ~/.cache/yarn

      # Store yarn / webpacker cache
      - save_cache:
          key: yarn-cache-{{ checksum "yarn.lock" }}
          paths:
            - ~/.cache/yarn

      - run:
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

      # Database setup
      - run: bundle exec rake db:create
      - run: bundle exec rake db:schema:load --trace

      # run tests!
      - run:
          name: run tests
          command: |
            mkdir /tmp/test-results
            TEST_FILES="$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)"

            bundle exec rspec --format progress \
                            --format RspecJunitFormatter \
                            --out /tmp/test-results/rspec.xml \
                            --format progress \
                            $TEST_FILES

      # collect reports
      - store_test_results:
          path: /tmp/test-results
      - store_artifacts:
          path: /tmp/test-results
          destination: test-results

#2

If you install something with apt it is very likely that it is not installed in vendor/lib unless you move it there explicitly.

Do you know where this library gets installed by default?


#3