Read more

Rubygems: Rebuild native extensions

Tobias Kraze
November 06, 2012Software engineer at makandra GmbH

Rarely, you might want to rebuild all gems with native extensions, because they might be compiled against outdated system libraries, resulting in some warnings or even segfaults or other ruby errors.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

You can do that using

gem pristine --all

This will reset all gems to a pristine state as if you'd reinstall them, and as a side effect, rebuild all native extensions.

The above command will also help you sorting out errors like this after a distribution upgrade:

libmysqlclient_r.so.16: cannot open shared object file: No such file or directory - /home/henning/.rvm/gems/ruby-1.8.7-p358/gems/mysql2-0.3.11/lib/mysql2/mysql2.so

(Because the library which is used to compile the gem doesn't exist anymore and you have to recompile it.)

Posted by Tobias Kraze to makandra dev (2012-11-06 14:07)