event machine gem bundle install is not working - ruby-on-rails

I am following a tutorial and had to do a bundle install following the forking & cloning of a repository. Subsequently we are instructed to run bundle install. However, it is not working and I am getting the following error message:
make
generating rubyeventmachine-i386-mingw32.def
compiling binder.cpp
In file included from binder.cpp:20:0:
project.h:85:0: warning: "FD_SETSIZE" redefined
<command-line>:0:0: note: this is the location of the previous definition
compiling cmain.cpp
In file included from cmain.cpp:20:0:
project.h:85:0: warning: "FD_SETSIZE" redefined
<command-line>:0:0: note: this is the location of the previous definition
cmain.cpp: In function 'int evma_send_file_data_to_connection(long unsigned int,
const char*)':
cmain.cpp:752:6: error: 'fstati64' was not declared in this scope
make: *** [cmain.o] Error 1
Gem files will remain installed in c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0
.0/gems/eventmachine-0.12.10 for inspection.
Results logged to c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/eventmach
ine-0.12.10/ext/gem_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot
continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.
I'm rather stuck on what to do at this point. I am on a Windows machine, any advice on how to troubleshoot this?

Try gem install eventmachine -v '0.12.10' Or sudo gem install eventmachine -v '0.12.10' and then retry bundle install.
Some gem needs sudo privileges to install.
For windows gem install eventmachine --pre. Its a known issue for window with ruby 1.9. https://github.com/eventmachine/eventmachine/issues/319

I was able to fix this by installing the latest version of the Eventmachine gem: https://rubygems.org/gems/eventmachine
And then subsequently instaling the latest version of the SQLite gem:
http://rubygems.org/gems/sqlite3-ruby
You might be prompted to update your Gemlockfile make sure to do that then everything else should work.

Related

Bundle install errors and cannot continue, even after installing missing gems

I am working on multiple Ruby on Rails applications and running...
MacOS 10.15.7,
Ruby 2.6.5,
Rails 5.2.3,
In a project app directory I am trying to run a bundle install and get the following error:
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
I proceed to install the gem from the specified source and get confirmation of install
Building native extensions. This could take a while...
Successfully installed jaro_winkler-1.5.3
Parsing documentation for jaro_winkler-1.5.3
Done installing documentation for jaro_winkler after 0 seconds
1 gem installed
after running bundle install again, I will get the original error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210406-62421-10txxc5.rb extconf.rb
creating Makefile
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR=" clean
current directory:
/private/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3/ext/jaro_winkler
make "DESTDIR="
make: *** No rule to make target
`/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h',
needed by `adj_matrix.o'. Stop.
make failed, exit code 2
Gem files will remain installed in
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/gems/jaro_winkler-1.5.3
for inspection.
Results logged to
/var/folders/yr/dw4ljvv14cl9vp76jt_6zqrsv1qhkf/T/bundler20210406-62421-1bm7o1ijaro_winkler-1.5.3/extensions/universal-darwin-19/2.6.0/jaro_winkler-1.5.3/gem_make.out
An error occurred while installing jaro_winkler (1.5.3), and Bundler cannot continue.
Make sure that `gem install jaro_winkler -v '1.5.3' --source
'https://.../api/gems/rubygems/'` succeeds before bundling.
The error message above doesn't give me any clear indication of what is happening. Additionally there is no such directory in the location where the message says "results logged to."
This seems to be happening in multiple application directories - but with different affected gems in each directory. They are all similar in that the error reads "make sure gem succeeds before bundling", then the gem install will succeed, and then the following bundle install will fail with the same original message.
Earlier today I did a clean Ruby 2.6.5 install and updated the Xcode CLI via xcode-select --install
If I run gem which jaro_winkler I get
/Users/{username}/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/jaro_winkler-1.5.3/lib/jaro_winkler.rb
Does anyone have any information on what could be causing this? I cannot do any bundle install without this happening. Please let me know if any more information is desired.
Thank you!
You mentioned that you are using ruby 2.6.5, but the gem is attempting to be installed in 2.6.0. Check that your Gemfile has the correct Ruby version in it.
When you ran gem which, it looks you are using rbenv. Make sure that you are using the correct Ruby version in there, too. Those rubies get installed in a different directory than xcode's. Sometimes there's a .rbenv file in the dir that will set the version as well.
Just some ideas. Hopefully something sticks.
Ended up being an issue with gem install location - export PATH="/usr/local/bin:$PATH" was previously added to my .bash_profile and this was effecting where gems were installed.
Somewhere in the error message /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby is mentioned - this is the "system default" Mac version of Ruby and is not the Ruby version I was intending to use with .rbenv ( 2.6.5 ) and gem installs.
Removing the export mentioned above help resolve the issue.
edit- wording

An error occurred while installing RedCloth (4.2.7), and Bundler cannot continue

I have an app on the Heroku Bamboo stack and have been following the instructions here (https://devcenter.heroku.com/articles/cedar-migration) for migrating to the Cedar stack.
My app has an older version of RefineryCMS (1.0.3) and I'm trying to avoid dealing with an upgrade there (for now), and so I've kept Rails at 3.0.9. Still, Ruby 1.8.7 is past EOL, so I needed to upgrade that at least. I specified 1.9.3 in my Gemfile, thus:
source "https://rubygems.org"
ruby "1.9.3"
And then I attempted to bundle install. Here's my output from that attempt:
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 0.8.7
Installing RedCloth 4.2.7 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/day/.rvm/rubies/ruby-1.9.3-p551/bin/ruby -r ./siteconf20151105-14593-x80q4a.rb extconf.rb
checking for main() in -lc... no
creating Makefile
make clean
make
compiling redcloth_attributes.c
ragel/redcloth_attributes.c.rl: In function 'redcloth_attribute_parser':
ragel/redcloth_attributes.c.rl:26:11: error: variable 'act' set but not used [-Werror=unused-but-set-variable]
ragel/redcloth_attributes.c.rl: In function 'redcloth_attributes':
ragel/redcloth_attributes.c.rl:45:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
ragel/redcloth_attributes.c.rl: In function 'redcloth_link_attributes':
ragel/redcloth_attributes.c.rl:54:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
cc1: all warnings being treated as errors
make: *** [redcloth_attributes.o] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/day/.rvm/gems/ruby-1.9.3-p551/gems/RedCloth-4.2.7 for inspection.
Results logged to /Users/day/.rvm/gems/ruby-1.9.3-p551/extensions/x86_64-darwin-14/1.9.1/RedCloth-4.2.7/gem_make.out
An error occurred while installing RedCloth (4.2.7), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.7'` succeeds before bundling.
Needless to say gem install RedCloth -v '4.2.7' resulted in the same error.
I found this question, Failed to build gem native extension when install RedCloth-4.2.9 install Linux, however, my issue was with RedCloth 4.2.7 (not 4.2.9) and I'm running OSX Yosemite (not Linux). There was an answer there which pertained to OSX Mountain Lion though, and I thought it was worth a try:
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
Obviously, I changed 1.9.2 to 1.9.3 for my purposes, and I omitted the --no-ri --no-rdoc flags. Sadly, bundle install continued to fail with the same error.
Continuing my search online, I found this article, Install RedCloth 4.2.7 gem with bundler (using ruby enterprise edition 1.8.7). Not dissuaded by the version mismatch (again, I'm using Ruby 1.9.3, not 1.8.7), I decided to try the advice I found there, to wit:
bundle config build.RedCloth --with-cflags=-w
bundle install
This time, oh joy! it worked! And I'm on to whatever's next. I thought I would share this little journey here for any others who find themselves in the same predicament. Cheers!
I was able to resolve this issue by specifying extra build options for Bundler which are applied when building RedCloth, as follows:
bundle config build.RedCloth --with-cflags=-w
bundle install

Cannot install Puma gem on Ruby on Rails

I'm trying to install the puma gem, but when I run
gem install puma
I get this error message:
Temporarily enhancing PATH to include DevKit
Building native extensions. This could take a while...
ERROR: Error installing puma:
ERROR: Failed to build gem native extension.
C:/Ruby193/bin/ruby.exe extconf.rb
creating Makefile
make
generating puma_http11-i386-mingw32.def
compiling http11_parser.c
ext/http11/http11_parser.rl: In function 'puma_parser_execute':
ext/http11/http11_parser.rl:111:3: warning: comparison between signed and unsigned integer expressions
compiling io_buffer.c
io_buffer.c: In function 'buf_to_str':
io_buffer.c:119:3: warning: pointer targets in passing argument 1 of 'rb_str_new' differ in signedness
c:/Ruby193/include/ruby-1.9.1/ruby/intern.h:653:7: note: expected 'const char *' but argument is of type 'uint8_t *'
compiling mini_ssl.c
In file included from mini_ssl.c:3:0:
c:/Ruby193/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
mini_ssl.c:4:25: fatal error: openssl/bio.h: No such file or directory
compilation terminated.
make: *** [mini_ssl.o] Error 1
Gem files will remain installed in C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0 for inspection.
Results logged to C:/Ruby193/lib/ruby/gems/1.9.1/gems/puma-2.6.0/ext/puma_http11/gem_make.out
Adding gem 'puma' to my Gemfile and running bundle install isn't an option, because that just doesn't work with any gem and gives me an error message (which is a separate issue, one that I've circumvented with the other gems I've used by installing them via gem install).
Came across very same issue.
sudo apt-get install libssl-dev
fixed it for me.
I ran bundle update before bundle install and that solved the issue for me.
I'm not sure if that was the only thing that helped, as I manually updated puma before that, using these steps:
Checked which version of openssl Ruby is using by running ruby -v -ropenssl -e "puts OpenSSL::OPENSSL_VERSION"
Downloaded the right openssl version from
http://packages.openknapsack.org/openssl/openssl-1.0.0o-x86-windows.tar.lzma
(got the link from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows and edited it based on the output of #1).
Extracted openssl using http://www.7-zip.org to C:\RailsInstaller\openssl
gem install puma -- --with-opt-dir=C:/RailsInstaller/openssl
Figured out the solution to the puma bundle. Followed directions from https://github.com/hicknhack-software/rails-disco/wiki/Installing-puma-on-windows
First you need to download:
DevKit compatible with your ruby version
OpenSSL Developer Package (contains header files and binaries)
And then:
Install DevKit, e.g. in c:\devkit
Unpack the OpenSSL Package, e.g. in c:\openssl (use 7Zip or PeaZip)
You need to copy the ddls from the bin directory (libeay32.dll and ssleay32.dll) to your ruby/bin directory.
Open a windows console
Initialize the DevKit build environment: c:\devkit\devkitvars.bat (except here, I used this in command prompt instead: ruby dk.rb init)
Now it’s possible to install the puma gem with the OpenSSL packages:
gem install puma -- --with-opt-dir=c:\openssl
I think you hit issue #430
https://github.com/puma/puma/issues/430
Re-installing Ruby might help you as well as it closed this issue on GitHub.

therubyracer error ERROR: While executing gem ... (NoMethodError) undefined method `size' for nil:NilClass

while installing therubyracer along with Ruby 2.0.0.p0 and Rails 4.0, i get the following error
ERROR: While executing gem ... (NoMethodError)
undefined method `size' for nil:NilClass
If I install same gem in using bundle install then I get dependent gem error see below log.
NoMethodError: undefined method `size' for nil:NilClass
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
Please find the link for GIT which i was trying to install
https://github.com/niquola/angularjs-on-rails
I ran to the same problem today. And got it solved. I'm using Lubuntu 13.04, RVM and Ruby 1.9.3 instead.
It could be that your platform is not in the supported list of libv8, which is used by rubyracer, and the gem should be compiled by yourself.
Straight from: https://github.com/cowboyd/libv8
Get libv8 source from git, compile it and build gem from:
git clone git://github.com/cowboyd/libv8.git
cd libv8
bundle install
bundle exec rake checkout
bundle exec rake compile
bundle exec rake build
Install gem:
gem install ./pkg/libv8-3.16.14.3.gem
I still got an error when executed "bundle update" on my project folder, because gem didn't seem to be copied to my bundle gem cache.
Bundler::GemspecError: Could not read gem at /home/devmachine/.rvm/gems/ruby-1.9.3-p448/cache/libv8-3.16.14.3.gem. It may be corrupted.
An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.3'` succeeds before bundling.
So I copied it to this folder before I ran "bundle update" again:
cp /home/devmachine/Downloads/libv8/pkg/libv8-3.16.14.3.gem /home/devmachine/.rvm/gems/ruby-1.9.3-p448/cache
Keep in mind that you should have following packages installed before performing compilation:
git
git-svn
libv8-dev
python
g++
I hope it helps.
- = Better solution = -
Actually a case of RTFM.
You dont have to build your own gem with native extension. You just have to have v8 library present in your system. After that you can configure bundler to use native v8. For that you should install V8 engine on your system.
# Get Google v8 engine from git
git clone git://github.com/v8/v8.git v8 && cd v8
# Install GYP
make dependencies
# I had problems with warnings and strict aliasing. So I ignored and switched them off.
make native werror=no strictaliasing=off
Now you should be able to use v8 from system:
bundle config build.libv8 --with-system-v8
After this command you can continue using usual "bundle install"..
- = Suggested solution = -
Forget v8 and use Node.js instead:
wget http://nodejs.org/dist/node-latest.tar.gz
tar zxvf node-latest.tar.gz
# cd into extracted directory (e.g. cd node-v0.10.14)
make
make install
Remove "therubyracer" dependency from your project Gemfile.

Having trouble installing gem "termios" after trying to update Rails

I am attempting to update Rails from 3.1.3 to 3.2.8. Changing the rails gem value and running "bundle update rails" tries to install a gem called "termios" version 0.9.4, and this fails with the following message:
Installing termios (0.9.4) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/me/.rvm/rubies/ruby-1.9.3-p0/bin/ruby extconf.rb
checking for termios.h... yes
checking for unistd.h... yes
creating Makefile
make
compiling termios.c
In file included from termios.c:10:
/Users/me/.rvm/rubies/ruby-1.9.3-p0/include/ruby-1.9.1/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h"
termios.c: In function ‘Termios_to_termios’:
termios.c:182: error: ‘struct RArray’ has no member named ‘ptr’
termios.c:183: error: ‘struct RArray’ has no member named ‘ptr’
termios.c: In function ‘termios_tcgetattr’:
termios.c:200: error: ‘OpenFile’ undeclared (first use in this function)
make: *** [termios.o] Error 1
Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p0#mcp5/gems/termios-0.9.4 for inspection.
Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p0#mcp5/gems/termios-0.9.4/./gem_make.out
An error occured while installing termios (0.9.4), and Bundler cannot continue.
Make sure that `gem install termios -v '0.9.4'` succeeds before bundling.
Please note also that this is the first time that I have updated Rails since I have gone to OS X Mountain Lion.
I have seen another answer about this question that said to install a gem called "ruby-termios". I did that, and that gem installed fine, but there is still a dependency somewhere that tries to install the "termios" gem.
I ended up cloning the ruby-termios gem into my repo. For some unknown reason, the author named it ruby-termios instead of just termios. So I renamed the gemspec. Then I modified my Gemfile to use:
gem 'termios', :path => 'termios'
Then I ran:
bundle update
And everything is working again.
It seems that specifying gem 'engineyard' in your Gemfile will cause bundler to install some ancient version (0.2.x), which has the termios dependency.
Specifying a newer one (gem 'engineyard', '~> 2.3') will install correctly.
gem install ruby-termios solved the make issues for me; I expect gem "ruby-termios" in your Gemfile will work too.
Looks like what happened is that the original author of the gem named termios (arika) hasn't updated the gem since 2004 (v 0.9.4), but nobody owns the namespace on rubygems http://rubygems.org/gems/termios. Then someone else (edison) made a fork on github https://github.com/edison/ruby-termios, and someone else (tylerrick) pushed a new gem named ruby-termios... but of course inside Ruby, the library is still named termios so the command is still require "termios".

Resources