I'm new to Ruby on Rails, and am trying to make an app.
I ran rails new myApp, and it ran into a problem when installing byebug.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
C:/Ruby21/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR=" clean
0 [main] rm 5012 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
make: [clean-static] Error 5 (ignored)
0 [main] rm 4148 open_stackdumpfile: Dumping stack trace to rm.exe.stackdump
make: [clean] Error 5 (ignored)
make "DESTDIR="
generating byebug-i386-mingw32.def
compiling breakpoint.c
cc1.exe: warnings being treated as errors
In file included from c:/Ruby21/include/ruby-2.1.0/ruby/defines.h:217:0,
from c:/Ruby21/include/ruby-2.1.0/ruby/ruby.h:29,
from c:/Ruby21/include/ruby-2.1.0/ruby.h:33,
from ./byebug.h:4,
from breakpoint.c:1:
c:/Ruby21/include/ruby-2.1.0/ruby/win32.h:320:44: error: 'struct timespec' declared inside parameter list
c:/Ruby21/include/ruby-2.1.0/ruby/win32.h:320:44: error: its scope is only thisdefinition or declaration, which is probably not what you want
c:/Ruby21/include/ruby-2.1.0/ruby/win32.h:321:43: error: 'struct timespec' declared inside parameter list
make: *** [breakpoint.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby21/lib/ruby/gems/2.1.0/gems/byebug-4.0.5 for inspection.
Results logged to C:/Ruby21/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/byebug-4.0.5/gem_make.out
An error occurred while installing byebug (4.0.5), and Bundler cannot continue.
Make sure that `gem install byebug -v '4.0.5'` succeeds before bundling.
So it looks like the compiler is treating warnings as errors, and byebug has a warning? And I need to configure the compiler to not treat warnings as errors?
You should try to uninstall/reinstall DevKit for Windows as MarsAtomic adviced.
For Mac what worked for me was running
xcode-select --install
and specifying github: 'deivid-rodriguez/byebug' for byebug in Gemfile (not sure that it's necessary though).
Related
I am following a heroku tutorial where I created my rails app. I was asked to use Heroku to get my app live online. But I have troubled to run the command Bundle install. It keeps giving me an error.
I tried to re-install Rail Bundler on my Terminal, but it shows me this error at the terminal:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
extconf.rb
creating Makefile
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10:
fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^
1 error generated.
make: *** [generator.o] Error 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for
inspection.
Results logged to
/Library/Ruby/Gems/2.0.0/gems/json-1.8.1/ext/json/ext/generator/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot
continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
While I am trying to create the new rails project, I face to error that is related to the lack of json gem.
When I try to install json gem, this error happens:
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
C:/Ruby22-x64/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating generator-x64-mingw32.def
compiling generator.c
In file included from c:/Ruby22-x64/include/ruby-2.2.0/ruby/ruby.h:29:0,
from c:/Ruby22-x64/include/ruby-2.2.0/ruby.h:33,
from ../fbuffer/fbuffer.h:5,
from generator.c:1:
c:/Ruby22-x64/include/ruby-2.2.0/ruby/defines.h:26:19: fatal error: stdio.h: No such file or directory
compilation terminated.
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/json-1.8.3 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/json-1.8.3/gem_make.out
If you want to install Ruby 2 (or greater) on Windows 7 (64 bit), you need to install DevKit 64 bit as well. Your Devkit has to be compatible with your operating system.
So, make sure you installed the correct Ruby and the compatible Devkit on your system.
See this tutorial for more information.
There was a group of gems which are dependent together. So, I had to install step by step.
As I did it based on error messages and one by one, I forgot to make a note about the steps.
I'm currently trying to embark on my first rails project and when I try to run the command rails new file_name I eventually get the error ERROR: Failed to build gem native extension.
I am currently using rvm to run ruby 2.2 on my mac osx 10.8.5. Everytime I run rails it seems to fail at the json gem.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
I am lost as to what is going on. If I try to run install json I also get a failed to build native extension error. Could it be my versions of xcode command line tools because when I try to run xcode-select --install it says command doesn't exist? I don't know. Any help would be appreciated.
edit as per Leonardo's request:
Installing json 1.8.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/davidgarczynski/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150817-32366-1n36tmw.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
make: I.: No such file or directory
make: [generator.o] Error 1 (ignored)
linking shared-object json/ext/generator.bundle
make: dynamic: No such file or directory
make: [generator.bundle] Error 1 (ignored)
make "DESTDIR=" install
compiling generator.c
make: I.: No such file or directory
make: [generator.o] Error 1 (ignored)
linking shared-object json/ext/generator.bundle
make: dynamic: No such file or directory
make: [generator.bundle] Error 1 (ignored)
/usr/bin/install -m 0755 generator.bundle ./.gem.20150817-32366-b8ng6y/json/ext
install: generator.bundle: No such file or directory
make: *** [install-so] Error 71
make install failed, exit code 2
Gem files will remain installed in /Users/davidgarczynski/.rvm/gems/ruby-2.2.1/gems/json-1.8.3 for inspection.
Results logged to /Users/davidgarczynski/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/json-1.8.3/gem_make.out
An error occurred while installing json (1.8.3), and Bundler cannot continue.
Make sure thatgem install json -v '1.8.3'succeeds before bundling.
I want to run a Rails 4.2.1 application in a docker container on a debian machine.
When I run bundle exec rails s I got this error:
Could not find json-1.7.7 in any of the sources
Run `bundle install` to install missing gems.
When I run bundle install I got this error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150604-137-10l84fa. rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling generator.c
In file included from generator.c:1:0:
../fbuffer/fbuffer.h: In function 'fbuffer_to_s':
../fbuffer/fbuffer.h:175:47: error: macro "rb_str_new" requires 2 arguments, but only 1 given
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
../fbuffer/fbuffer.h:175:20: warning: initialization makes integer from pointer without a cast
VALUE result = rb_str_new(FBUFFER_PAIR(fb));
^
Makefile:237: recipe for target 'generator.o' failed
make: *** [generator.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/www/test/xyz/vendor/bundle/ruby/2 .2.0/gems/json-1.7.7 for inspection.
Results logged to /var/www/test/xyz/vendor/bundle/ruby/2.2.0/extensions/x 86_64-linux/2.2.0/json-1.7.7/gem_make.out
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
Whats going wrong? what can I do now?
docker-rails is a project I just created to make rails with docker (and CI) very easy. I think it can help you and reduce the amount of configuration necessary to get up and running with rails on docker.
It creates a global shared gem volume (to speed up bundler), and has a sample Dockerfile for use.
Given that native error, I'm guessing your Dockerfile is missing a needed package, you may need to update your apt-get statements.
I got the same error. This error is because of the versions of ruby softwares (gems) that we uses doesn't match at some point.
You are using ruby version 2.2.1. Your Gemfile contains the gems of older versions and it depends on json version 1.7.7.
You should install the following ruby version:
ruby-1.9.3-p448
to get rid of the error, OR updating your gems that compatible with ruby version 2.2.1 will do the trick.
I'm trying to upgrade my rails 3.2.3 app. I've updated the gemfile to gem 'rails', '3.2.11' and ran bundle update rails but got the following error:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Arel/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
creating Makefile
make
compiling generator.c
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Gem files will remain installed in /Users/Arel/.rvm/gems/ruby-1.9.3-head/gems/json-1.7.6 for inspection.
Results logged to /Users/Arel/.rvm/gems/ruby-1.9.3-head/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
An error occured while installing json (1.7.6), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.6'` succeeds before bundling.
So I tried the solution that I found everywhere, to create a symlink using the command:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
but that just returns the error:
ln: /usr/bin/gcc-4.2: File exists
I don't know a lot about using the terminal to navigate around OSX, so I'm kind of struggling here. Any ideas?
/usr/bin/gcc-4.2 could already be a symlink, but a broken one that points to a nonexistent file.