While I was migrating my wife's site to Rails 3 on Heroku, I encountered the following error
Installing linecache19 (0.5.11) with native extensions /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
To solve the problem above, add a config variable in heroku specifying that gems listed under a specific group should not be installed.
heroku config:add BUNDLE_WITHOUT="development test"
So adding the code above will skip gems under the development and test groups.