Trying to start rails server - ruby-on-rails

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

Related

With Ruby On Rails 4.2.5.1 I can gem install therubyracer but bundle fails on OS X 10.11.1

Using rbenv for a Ruby 2.3.0 environment on OS X 10.11.1 I am unable to get therubyracer Gem to install when using 'bundle'.
This is successful:
> gem install therubyracer
Building native extensions. This could take a while...
Successfully installed therubyracer-0.12.2
Parsing documentation for therubyracer-0.12.2
Done installing documentation for therubyracer after 0 seconds
1 gem installed
In my Gemfile:
gem 'therubyracer', '0.12.2', platforms: :ruby
This fails:
> bundle
Installing therubyracer 0.12.2 (was 0.12.1) with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/jsidlosky/code/sentons/websocket-rails-demo/.bundle/gems/therubyracer-0.12.2/ext/v8
/Users/jsidlosky/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20160215-9105-1s1s0pv.rb extconf.rb
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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.
....
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/jsidlosky/code/sentons/websocket-rails-demo/.bundle/extensions/x86_64-darwin-15/2.3.0-static/therubyracer-0.12.2/mkmf.log
The mkmf.log file's error is:
conftest.c:3:10: fatal error: 'v8.h' file not found
Some things I've tried:
From: How to install therubyracer gem on 10.10 Yosemite?
git clone https://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake clean build binary
gem install pkg/libv8-3.16.14.13.gem
From: Bundle install tries to use cache file
Adding to ~/.bundle/config
BUNDLE_PATH: .bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"
I also tried this:
bundle config build.libv8 --with-system-v8
I've now spent well over 5 hours trying other random ideas from various StackOverflow questions and other sites. So far, nothing gets me a working therubyracer inside "bundle" even though "gem install therubyracer" works just perfectly.
I will be very grateful for any pointers or solutions.
It appears from the comment from: github.com/cowboyd/therubyracer/issues/359
"I wasn't able to get any of the above solutions to work (or rather, everything I could get to work would have required the rest of my team to rebundle). After switching from rbenv to RVM, however, bundle install ran without a hitch."
I tried switching from rbenv to RVM and it worked perfectly. I can now 'bundle' and therubyracer gem installs perfectly.

Pushing to heroku fails due to sqlite3 on Mac

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

Rails - Not uploading to heroku after upgrading ruby to 1.9.3 and rails to 3.2

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

how do I install ruby-debug in ruby 1.9.3 / Rails 3.2.1 [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with “Symbol not found: _ruby_threadptr_data_type”
I'm done with printing to the console -- I want to move up to the 20th century and start using a debugger!! But how do I install ruby-debug? The native compilation of ruby-debug.c fails when I try to install the ruby-debug19 gem. I've looked over other SO postings and haven't found the answer yet...
I am using Ruby 1.9.3-p0
I am using Rails 3.2 (with Gemfile, of course)
I am NOT using RVM -- instead, I have a fully sandboxed directory containing all executables, gems, sources, etc. I refer to it as $SANDBOX below...
bundle install doesn't work
If I add ruby-debug19 to my Gemfile and do bundle install, it fails during build with conflicting types for 'rb_iseq_compile_with_option':
# file: Gemfile
...
group :development do
gem 'ruby-debug19'
end
...
% bundle install
...
Installing ruby-debug-base19 (0.11.25) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/r/Developer/Topaz/usr/bin/ruby extconf.rb
...
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here
...
make: *** [ruby_debug.o] Error 1
gem install ruby-debug from the command line doesn't work
If I try building the gem from the command line, using the --with-ruby-include argument pointing at the include directory for the current ruby, I get the same error:
% gem install ruby-debug19 -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug19:
ERROR: Failed to build gem native extension.
$SANDBOX/usr/bin/ruby extconf.rb --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0/include
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... yes
creating Makefile
make
compiling breakpoint.c
compiling ruby_debug.c
ruby_debug.c:29: error: conflicting types for 'rb_iseq_compile_with_option'
$SANDBOX/usr/include/ruby-1.9.1/ruby-1.9.3-p0/vm_core.h:505: error: previous declaration of 'rb_iseq_compile_with_option' was here
what am I missing?
Is --with-ruby-include expecting something different? Is the current ruby-debug19 broken?
Thanks to #Marc Talbot's comment in the OP, I found a working recipe.
download linecache19 and ruby-debug-base19 from RubyForge:
% curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
% curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
compile the two gems
% gem install linecache19-0.5.13.gem
Building native extensions. This could take a while...
Successfully installed linecache19-0.5.13
1 gem installed
...
% gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$SANDBOX/packages/ruby-1.9.3-p0
Building native extensions. This could take a while...
Successfully installed ruby-debug-base19-0.11.26
1 gem installed
...
update your Gemfile
# file: Gemfile
...
group :development do
gem 'linecache19', '0.5.13'
gem 'ruby-debug-base19', '0.11.26'
gem 'ruby-debug19', :require => 'ruby-debug'
end
bundle install and test the debugger
% bundle install
Fetching source index for http://rubygems.org/
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
% irb
irb(main):001:0> require 'ruby-debug'
=> true
irb(main):002:0> debugger
$SANDBOX/usr/lib/ruby/1.9.1/irb/context.rb:166
#last_value = value
(rdb:1) p 'hooray'
"hooray"
Hopefully this will help others.
(From your logs, I assume you are on Linux, specifically a Debian distro)
There is a simple solution to this:
In the shell,
sudo apt-get install ruby-dev1.9.3
Note: I don't actually know if there is a package called ruby-dev1.9.3, because I installed ruby-dev for 1.9.2, which was ruby-dev1.9 (I think. That was a while ago. If anyone knows what they are, please comment).
This package installs the headers that the C extensions to the interpreter need (ruby.h).

Trouble Getting the Rails Server Started

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

Resources