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 UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
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)