I've seen multiple questions, all with the same problems as me. I tried all the solutions proposed, such as making the following my Gemfile
group :development, :test do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Added, committed, and nothing. Still the same issue when I run git push heroku master:
em::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
tmp/build_d2c698fb-cf76-40cd-b046-9866c3432e8b/vendor/ruby-2.0.0/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
I tried installing Xcode to see if that solves it, but it didn't. Ran brew install sqlite3 which also didn't solve it.
I also checked the dependencies of my gems in my Gemfile, with gem dependency and also checking the Gemfile.lock file, which shows no dependencies for the sqlite3 gem.
I can't find a solution to this problem from existing questions. Maybe I skimmed over something I am missing, but I can't find it.
Some extra information:
$ rails -v
Rails 4.1.1
$ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin13.1.0]
$ gem -v
2.2.2
$ sqlite3 -version
3.7.13 2012-07-17
Related
I've cd in app root directory, and ran rails s. Then I get the error:
Could not find gem 'rbczmq' in any of the gem sources listed in your Gemfile or available on this machine.
Installing the gem manually, with gem install rbczmq, had no success because of this:
ERROR: Error installing rbczmq:
ERROR: Failed to build gem native extension.
/home/iulian/.rvm/rubies/ruby-2.3.1/bin/ruby extconf.rb
"./autogen.sh"
autogen.sh: error: could not find libtool. libtool is required to run autogen.sh.
ZeroMQ autogen failed!
* extconf.rb failed *
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Then, I presumed that it needs libtool. I've tried to install it but it prompted that it is installed under the most recent version.
I've search lastly that file, mkmf.log under the path ~/.rvm/gems/ruby-2.3.1/gems/rbczmq/ext/mkmf.log but with no success. In the others installed gems directories this file exists, so I suppose that I don't find it in this problematic gem because it hasn't finished installing.
This app is programmed using rails 4, and I am trying to run it using Rails 5. This is also the Gemfile:
source 'https://rubygems.org'
gem 'rails'
gem 'sqlite3'
gem 'tzinfo-data'
gem 'rbczmq'
gem 'iruby'
gem 'spring', group: :development
gem 'elasticsearch-persistence', :require => 'elasticsearch/persistence'
Which could be the problem and how could I solve it?
I had this problem once. Do this
sudo apt-get install libgmp-dev
or
sudo apt-get install libgmp3-dev
Originally I couldn't push my rails 4 app to heroku because my database was sqlite, and so now I have been trying to install the Postgresql gem ('pg') but I am not having any luck. This is the error message I get in my terminal after running bundle install:
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
--with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
After running
gem install pg -v '0.17.1' -–with-pg-config
I get this error in my terminal:
ERROR: While executing gem ... (Gem::Requirement::BadRequirementError)
Illformed requirement ["0.17.1--with-pg_config"]
/project$ gem install pg -v '0.17.1'--with-pg-config
ERROR: Could not find a valid gem 'pg' (= 0.17.1.pre..pre.with.pre.pg.pre.config) in
any repository
ERROR: Possible alternatives: pg
Thanks for the help.
If you don't have postgres installed, you may want to go with:
sudo apt-get install postgresql
sudo apt-get install libpq-dev
following by gem install pg and bundle.
If you do have postgres installed and running gem install pg doesn't work, you have to run which pg_config to get the path to your pg_config, and run gem install pg -- --with-pg-config= output_from_previous_command.
I had this app using 1.9.2 and rails 3.2
and today I changed the ruby version into 1.9.3 (using rbenv)
and everything went wrong then
I had this on my gemfile
group :development do
gem 'sqlite3'
end
group :production do
gem 'pg'
end
Everytime I run:
bundle install --without production
Nothing happens now and when I do
git push heroku master
I get the same error:
Installing sqlite3 (1.3.5) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
Its obviously trying to install sqlite, but even if I remove the sqlite gem from my Gemfile nothing happens, seems that the problem is in heroku but now I can't do nothing
Hope someone can help me because I was trying to do
heroku db:pull
and because of that I wanted to add the taps gem, then I followed this tutorial
http://railsapps.github.com/rails-heroku-tutorial.html
And I changed the version of ruby in heroku, now I think that the problem is rbenv but I'm not sure
Thanks in advance
Javier Q
Actually in order to get all the db I only had to do:
gem install taps
and not to put it into the Gemfile because it requires sqlite3
I have a rails 3.1 app that i am trying to push to Heroku. It keeps failing when i push it.
Installing sqlite3 (1.3.4) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
I changed my gem file to have the following lines:
gem 'sqlite3', :group => [:development, :test]
gem 'pg', :group => [:production]
Even after running bundle install etc i am getting the error. I even ran some tests without sqlite3 in my gem file and it still tries to install it on Heroku. Any suggestions?
Lol it turns out i was working on one branch and was pushing my master. Once i merged them and pushed the correct branch everything worked great.
The Cedar stack doesn't yet support bundle without according to the docs, http://devcenter.heroku.com/articles/bundler so it will still attempt to install it on deployment.
To be honest, you'd be much better using postgres locally if that is what you're deploying too.
When I run 'rails server' I get the following error:
Could not find gem 'sqlite3 (>= 0, runtime)' in any of the gem sources listed in your Gemfile.
My GemFile looks like this: gem 'sqlite3'
Also when I run the port command it says it does not recognize that command:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ port install sqlite3 +universal
-bash: port: command not found
Any suggestions?
UPDATE 1:
I run sudo gem install sqlite3 and got the following message:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ sudo gem install sqlite3
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
UPDATE 2: (Contents of GemFile)
source 'http://rubygems.org'
gem 'rails', '3.0.7'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'
# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
# gem 'webrat'
# end
UPDATE 3:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ port search sqlite3
-bash: port: command not found
UPDATE 4:
After downloading the install Macports I ran the bundle install again and here is the result:
Installing sqlite3 (1.3.3) with native extensions /usr/local/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:inbuild_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... no
sqlite3 is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
* extconf.rb failed *
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
`
UPDATE 5:
which sqlite3 gives me the following:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ which sqlite3
/opt/local/bin/sqlite3
UPDATE 5:
which -a sqlite3 gives me the following:
Mohammad-Azams-MacBook-Pro:blog azamsharp$ which -a sqlite3
/opt/local/bin/sqlite3
/usr/local/bin/sqlite3
/usr/bin/sqlite3
If you have problems talking about /usr/local/bin/ruby extconf.rb checking for sqlite3.h then it's probably something to do with macports.
First, make sure you have xcode installed. Run:
gcc
and you should get:
i686-apple-darwin10-gcc-4.2.1: no input files
If you do, then let's install homebrew
Then, a list of commands to install homebrew, update rubygems, and upgrade rails
brew install sqlite
gem update --system
gem install bundler
gem install rails -v=3.0.8
Then, to check, rails -v should output Rails 3.0.7
If you are running 10.4 or earlier you don't have sqlite 3 (the actual DB engine, not the gem) installed by default. You have 3 options (assuming upgrading your OS to 10.5 or 10.6 is not an option):
Compile the source (not as bad as it sounds) http://www.sqlite.org/download.html
Install MacPorts (why the port command was not found) http://www.macports.org/install.php
Don't use sqlite. Instead use mysql or another DB of your choice.
I recommend the latter if you are going to deploy using some DB other than sqlite, and deploying with sqlite generally isn't a good idea. I like to keep my development and production environments fairly uniform to help avoid gotchas and such.
I hope this helps.
I'm summing up in a reply. So :
1) Install macports : http://www.macports.org/install.php - It has a dmg installer, will take 2 minutes.
2) Once you have it installed, do a 'bundle install' and sqlite3 will be installed as specified in your Gemfile.
When you use port look for a package called sqlite3-dev or something similar to that. The -dev part is key. I don't use MacPorts, but on my Ubuntu install this is the needed package.
When you want to install a package that you plan to link against, always look for the -dev version. The -dev means that it installs the header files among other things that are needed for development against that package.
Most likely your gem cannot build the sqlite3 native extension because it is looking for the header files, if this does not solve your problem please post the log file for the gem installation.
From your Rails directory:
cd ..
cd rails-root
ruby -v
gem list sqlite3
bundle install
gem list sqlite3
bundle exec rails server
What might be happening is you're bundling in a Rails app that has an .rvmrc file. I've seen cases where you bundle under a version of Ruby that doesn't match the .rvmrc file or some other mismatch so when you bundle sqlite3 it isn't under the same version of Ruby that rails is using when you run the app.
Changing out of the directory and back into it, and running rails server prefixed with bundle exec are my two suggestions.
there were several links about your problem :
Install sqlite3 on mac osx?
Snow Leopard & Ruby on Rails - SQLite3 issue
http://railsforum.com/viewtopic.php?id=23018