Gem installed but "its extensions are not built"

I have a weird issue. The bundle install works fine but none of the extensions are installed.

I enabled ssh for the build box and while I’m on there, I can see the following:

ubuntu@box392:~/www.clockwisemd.com$ bundle
Using i18n 0.7.0
/snip/
Bundle complete! 6 Gemfile dependencies, 74 gems now installed.
Bundled gems are installed into ./vendor/bundle.

But it errors out on the bundle exec command that should work. (It’s a jekyll site that’s trying to be built.

ubuntu@box392:~/www.clockwisemd.com$ bundle exec jekyll build
Configuration file: /home/ubuntu/www.clockwisemd.com/_config.yml
  Dependency Error: Yikes! It looks like you don't have jekyll-mentions or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'libruby.so.2.3: cannot open shared object file: No such file or directory - /home/ubuntu/www.clockwisemd.com/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8/lib/nokogiri/nokogiri.so' If you run into trouble, you can find helpful resources at http://jekyllrb.com/help/!
jekyll 3.2.1 | Error:  jekyll-mentions

irb tells me the problem clearly:

ubuntu@box392:~/www.clockwisemd.com$ bundle exec irb
Ignoring ffi-1.9.14 because its extensions are not built.  Try: gem pristine ffi --version 1.9.14
Ignoring nokogiri-1.6.8 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.8
Ignoring therubyracer-0.12.2 because its extensions are not built.  Try: gem pristine therubyracer --version 0.12.2

So I try to install all three:

ubuntu@box392:~/www.clockwisemd.com$ gem install nokogiri --version 1.6.8
Fetching: mini_portile2-2.1.0.gem (100%)
Successfully installed mini_portile2-2.1.0
Fetching: pkg-config-1.1.7.gem (100%)
Successfully installed pkg-config-1.1.7
Fetching: nokogiri-1.6.8.gem (100%)
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.6.8
3 gems installed

Still no dice.

What am I missing?

Background info:

  • Tried both Ubuntu 12.04 (Precise) and Ubuntu 14.04 (Trusty)
  • “Open source” project but we have a paid account - not sure that matters.
  • pasted contents of stuff below
$ cat circle.yml
test:
  override:
    - bundle exec jekyll build

deployment:
  production:
    branch: master
    commands:
      - s3_website push

$ cat .ruby-version
ruby-2.3.1

$ bundle check
The Gemfile's dependencies are satisfied

$ bundle console
/home/ubuntu/www.clockwisemd.com/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2/lib/v8.rb:4:in `require': libruby.so.2.3: cannot open shared object file: No such file or directory - /home/ubuntu/www.clockwisemd.com/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2/lib/v8/init.so (LoadError)
	from /home/ubuntu/www.clockwisemd.com/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2/lib/v8.rb:4:in `<top (required)>'
	from /home/ubuntu/www.clockwisemd.com/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2/lib/therubyracer.rb:1:in `require'
	from /home/ubuntu/www.clockwisemd.com/vendor/bundle/ruby/2.3.0/gems/therubyracer-0.12.2/lib/therubyracer.rb:1:in `<top (required)>'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `require'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:86:in `block (2 levels) in require'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `each'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:81:in `block in require'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `each'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/runtime.rb:70:in `require'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler.rb:102:in `require'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli/console.rb:11:in `run'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli.rb:333:in `console'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/cli.rb:11:in `start'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/exe/bundle:27:in `block in <top (required)>'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `load'
	from /opt/circleci/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `<main>'
1 Like

I just encountered this same error when switching from one container (Ubuntu 12.04) to another (Ubuntu 14.04). I triggered a rebuild without cache, and all the gems were reinstalled successfully and the build succeeded. After one success without cache, subsequent builds also succeeded, but when I switched containers I did have to rebuilt without cache again.

I believe that switching the container led to the situation where bundler thought the gems were installed, but OS-level dependencies they had were not (bundler has no direct knowledge of these). Rebuilding without cache forced all the gems to reinstall, which installed their dependencies at that time.

2 Likes

We are seeing this approximately once or twice a day since around two weeks ago, especially on feature branches. We haven’t changes our Ruby version or CircleCI config recently. Rebuilding without cache fixes it. Very annoying.

This post saved me a lot of time. Thanks!

Having the same problem here. Did you ever find a solution to not have to keep sporadically clicking “rebuild without cache”?

1 Like

I now have this issue with 100% of builds. Need to rebuild without cache for it to work.

LoadError: libruby.so.2.4: cannot open shared object file: No such file or directory - /home/ubuntu/sigrid/vendor/bundle/ruby/2.4.0/gems/nokogiri-1.7.1/lib/nokogiri/nokogiri.so