Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

Just got bitten these types of errors and lost an hour nearby, so making a note here if that helps. If you ever get error while installation a gem that – Gem Install ExtensionBuildError that means, you are missing some libs.

As of now, I have following three types of installations generally failing at my machine – 1. Nokogiri (workaroud for this can be found on nokogiri website.)2. mysql gem installation.3. pg installation.4. sqlite3 installation.

In above, for 2nd, 3rd and 4th – all are databases, and if you don’t have dev packages for them, it fails. For e.g. in my openSuse 11.04 system, by default it doesn’t has the mysql-dev, postgresql-dev and sqlite3-dev libs installed and it fails for sure. For ubuntu these package names may differ.