gem install jekyll error on windows - ruby-on-rails

I have created new twitter-bootstrap project on Webstorm 7 and updated npm then executed the grunt comment I got the below error in Jekyll
Running "jekyll:docs" (jekyll) task Warning:
Please install Jekyll before running this task. Use --force to continue.
Aborted due to warnings.
Then I followed the steps as given by (http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html) URL now I am getting error on
gem install jekyll
step. Please look at the below error log on gem_make.out file
C:/Ruby200/bin/ruby.exe extconf.rb creating Makefile
make "DESTDIR=" generating stemmer-i386-mingw32.def compiling porter.c
make: execvp: gcc: Bad file number make: * [porter.o] Error 127
Please guide me how to come over this issue.

Here is a guide on How to Run Jekyll on Windows.
It covers installing the Ruby DevKit, which is most likely what you're missing.
Alternately, and assuming you're on Windows, you could install Ruby using scoop, it's very simple to use and it will install the DevKit along with Ruby.
I hope this helps.

Related

ERROR: Failed to build gem native extension Windows 7 32 Bit

I am trying to install json ruby gem on Windows 7 32 System.
The local environment details are
D:\Environment\DevKit32Ruby200>gem -v
2.0.14
D:\Environment\DevKit32Ruby200>ruby -v
ruby 2.0.0p451 (2014-02-24) [i386-mingw32]
D:\Environment\DevKit32Ruby200>rails -v
Rails 4.0.4
I have already tried following things
Downgrading system ruby gems version to 2.3.0 using
gem update --system 2.3.0
I have done proper setting of devkit and manually I added proper ruby directory path in config.yml file.
D:\Environment\DevKit32Ruby200>ruby dk.rb init
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
D:\Environment\DevKit32Ruby200>ruby dk.rb install --force
[WARN] Updating (with backup) existing gem override for 'D:/Environment/ruby200new'
[WARN] Updating (with backup) DevKit helper library for 'D:/Environment/ruby200new'
I have also tried putting platform=ruby
gem install json --platform=ruby --verbose
The error I am getting while installing json is bellow.
D:\Environment\DevKit32Ruby200>gem install json
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.
D:/Environment/ruby200new/bin/ruby.exe extconf.rb
creating Makefile
make "DESTDIR="
generating generator-i386-mingw32.def
compiling generator.c
linking shared-object json/ext/generator.so
make "DESTDIR=" install
/usr/bin/install -c -m 0755 generator.so ./.gem.20170109-8336-qvgvzc/json/ext
make: execvp: /usr/bin/install: Permission denied
make: *** [install-so] Error 127
Gem files will remain installed in D:/Environment/ruby200new/lib/ruby/gems/2.0.0/gems/json-2.0.2 for inspection.
Results logged to D:/Environment/ruby200new/lib/ruby/gems/2.0.0/gems/json-2.0.2/ext/json/ext/generator/gem_make.out
There are 10's of questions are already tagged on this issue but none resolved.
Kindly help me to identify whats missing and why the error coming.
i386-mingw32 is a mountain of pain that'll never be fully supported, when I spent time on Windows I used to use a VirtualBox VM with ubuntu installed which shares a folder with the Windows host. I would edit the files with netbeans in windows and run the code in putty, the VM would basically be headless.
I actually did a lot of real work that way. If you want to do a "Hello World" rails app - OK - good luck even with that. How about an online development environment such as https://c9.io/ ?
But if you want to work, not just play around, set yourself up with an Ubuntu VM at the very least, or work in Ubuntu/MacOS at the very best.
Try this out:
Why don't you download the json .gem file from rubygems.org and install it directly using command
gem install json-x.x.x.gem

ERROR: Error installing rmagick: in Windows with Ruby 2.2

I cloned my code from git to my Windows machine and when I run bundle install, I am getting this error:
An error occurred while installing rmagick (2.13.4), and Bundler
cannot continue. Make sure that gem install rmagick -v '2.13.4'
succeeds before bundling.
D:\project\MyProject2>gem install rmagick -v '2.13.4'
Temporarily enhancing PATH to include DevKit... Building native
extensions. This could take a while... ERROR: Error installing
rmagick:
ERROR: Failed to build gem native extension.
D:/RailsInstaller/Ruby2.2.0/bin/ruby.exe -r ./siteconf20160721-7208-bn9t3e.rb extconf.rb checking for Ruby version
= 1.8.5... yes Invalid drive specification. Unable to get ImageMagick version
* 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.
I tried downloading ImageMagick, and set environment paths as:
CPATH=D:\ImageMagick-6.9.5-Q8\include
LIBRARY_PATH=D:\ImageMagick-6.9.5-Q8\lib
and run bundle install but no use and also tried running
gem install rmagick -v '2.13.4' --platform=ruby -- --with-opt-lib=D:\ImageMagick-6.9.5-Q8\lib --with-opt-include=D:\ImageMagick-6.9.5-Q8\include
it is showing:
Unable to get ImageMagick version
* 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.
Please help.
I had this same issue myself until I finally stumbled upon the answer on Stackoverflow here and here.
Basically you need to follow these steps:
Install DevKit. Since I used RailsInstaller to install Ruby on Rails on my laptop, it was already included in the default directory ‘C:\Serever\RailsInstaller\DevKit‘. Otherwise, find the .exe at the RubyInstallers downloads.
Install ImageMagick-6.9.5-9-Q16-x86-dll.exe from imagemagick.org. It seems that rmagik2.16 only supports ImageMagick 6, not ImageMagick 7.
Make sure that you install the correct version of ImageMagick x86 or x32. If you are unsure what ruby version you have install try this command: ruby -e "puts 1.size". It print 4 if x86 and 8 if x64. answer from here
Check the following options on the install screen (more info on the redmine website) :
[v] Add application directory to your system path
[v] Install development headers and libraries for C and C++
Setup in windows environment variables the PATH variable to include the path to ImageMagick. In my case: C:\Server\ImageMagick\. Make sure it is the first variable in the variables list, or you may encounter an “Invalid drive specification” error when extconf.rb tries to identify the ImageMagick version.
cd C:\YourRubyProject. Example: C:\Server\htdocs\dev-ruby\redmine.
Set CPATH and LIBRARY_PATH environment variables to point respectively to ImageMagick installation directory include and lib subdirectories (so the DevKit will find them at build time)
Open C:\Serever\RailsInstaller\DevKit\msys.bat. More details here
Run gem install rmagick --platform=ruby -- --with-opt-lib=C:/Server/ImageMagick/lib --with-opt-include=C:/Server/ImageMagick/include. Adjust paths as necessary for your project.
Finally, run bundle install, or if necessary bundle update
Note: for those that are looking to install redmine in xampp follow this tutorial. If you get stuck on installing the rmagick lib, return here to this answer and follow the provided steps.

While installing http_parser.rb ERROR: Failed to build gem native extension

This error occurs when I try to install http_parser using gem:
dongl_000#LENNY ~/ava-home (master)
$ gem install http_parser.rb -v '0.6.0'
Building native extensions. This could take a while...
ERROR: Error installing http_parser.rb:
ERROR: Failed to build gem native extension.
c:/Ruby22-x64/bin/ruby.exe -r ./siteconf20160217-15056-1hoiyfc.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
generating ruby_http_parser-x64-mingw32.def
make: *** No rule to make target '/c/Ruby22-x64/include/ruby-2.2.0/ruby.h', need
ed by 'ruby_http_parser.o'. Stop.
make failed, exit code 2
Gem files will remain installed in c:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/http_p
arser.rb-0.6.0 for inspection.
Results logged to c:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0
/http_parser.rb-0.6.0/gem_make.out
How can I resolve this issue?
Versions
ruby : 2.2.1
rubyGem : 2.4.5
I was going through this very same issue.
Looked up the Git Repository for the Gem (HTTP_Parser) and found out the reason for my problem:
HTTP_Parser currently doesn't not support a Path with spaces
So I renamed my path and solved it.
To resolve attempt to add the devkit to Ruby like this:
Install Ruby+DevKit from RubyInstaller: Ruby Window Installers
Downloads
Check the "ridk install" checkbox at the end of the installer.
When RIDK runs, pick option 3 to install both MSYS and MINGW dev tools (make is provided with the MINGW stuff).
Open a fresh console (to get fresh environment variables), and rerun your gem or bundle command...and hope for the best.

Rails on windows - install issue

I'm trying to install ruby on a Windows box and am having an issue. I have gotten up to this point when I start getting errors, and I'm completely new to anything other than PHP for web development. Help appreciated!
EDIT I'm following the instructions here for wamp:
http://www.alexbernard.fr/fichiers/blog/Installer-Ruby-On-Rails-sur-un-Wamp-Server.pdf
./gem install rails --include-dependencies
Output:
INFO: `gem install -y` is now default and will be removed
INFO: use --ignore-dependencies to install only the gems you list
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
C:/wamp/ruby/bin/ruby.exe extconf.rb
creating Makefile
make
generating generator-x64-mingw32.def
compiling generator.c
make: x86_64-w64-mingw32-gcc: Command not found
make: *** [generator.o] Error 127
Gem files will remain installed in C:/wamp/ruby/lib/ruby/gems/2.0.0/gems/json-1.8.0 for inspection.
Results logged to C:/wamp/ruby/lib/ruby/gems/2.0.0/gems/json-1.8.0/ext/json/ext/generator/gem_make.out
From the output shown above, I assume the following:
Installed Ruby 2.0.0 x64 (64bits)
Installed some DevKit from RubyInstaller page
Now, as explained here, for 64bits Ruby you need 64bits DevKit.
From the error in the output:
make: x86_64-w64-mingw32-gcc: Command not found
It is clear you didn't install the right DevKit.
Please remove the DevKit installed, download the correct one (as indicated in the link above and in RubyInstaller downloads page) and install again.
You will require to use ruby dk.rb install --force (note the --force option) to override the previous DevKit installation.
As for the the deprecation error, --include-dependencies is no longer required. I recommend you use as installation reference a modern Ruby/Rails guide.
You can go the RailsInstaller way to install Rails and all dependencies in one go without getting into such problems.
For me, the problem was that the DevKit binaries did not get added to the PATH. Make sure that (DEVKIT_FOLDER)\mingw\bin is on the path.
Because I read this answer with hope of fixing my problem, and found it did not help, here's how I resolved it:
--
Your error is:
make: x86_64-w64-mingw32-gcc: Command not found
--
The error means that you don't have access to the gcc/gc++ compiler on your PC.
You should therefore either locate, or download a version of the compiler to your system. I found installing the build tools located here solved the issue.
You just have to download those tools, then add them to the PATH var: set PATH=C:/path/to/your/ming64/location/;%PATH%;
This should build it for you.
A caveat -- whether you have the correct dependencies for a build to take place is another question entirely.
The exe is in rubydevkit\mingw\bin. Just add that to your path and json will build.

"Failed to build gem native extension" when installing Rails

I'm new to Terminal so please bear with me. Completed installing the following successfully (in this particular order):
xCode 4.5
RVM 1.16
GCC 4.2.1
Ruby 1.9.3
When trying to install Rails ("gem install rails") the installation starts but is then interrupted with an error: "Failed to build gem native extension". No idea what this refers to. Ideas? Something else I need to install beforehand?
On my first attempt to install Rails I accidentally ran it with sudo. Will this affect anything?
Edit: And the output -
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/Users/staffanestberg/.rvm/rubies/ruby-1.9.3-p194/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/staffanestberg/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5 for inspection.
Results logged to /Users/staffanestberg/.rvm/gems/ruby-1.9.3-p194/gems/json-1.7.5/ext/json/ext/generator/gem_make.out
Edit: Solved using iouri's suggestion. Add export CC=gcc in .bash-profile then create a symlink for the correct compiler,
sudo ln -sf /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
Make sure you have command line tools for Xcode installed first, Xcode > Preferences > Downloads > Components. Then add this line to your .bash_profile file in your home folder ~/.bash_profile:
export CC=gcc
Double check that you have gcc (probably a symlink) in your /usr/bin (most likely), and that it is pointing to a valid gcc compiler, ex: gcc -> llvm-gcc-4.2
You might have to restart your terminal for this change to take affect.
Ruby is not fully ready for LLVM compilation, this includes clang, there is at least one known isue with Fibers, but depending on LLVM version other problems might appear.
The right way to fix it is to get gcc-4.2 there are many ways for it and the best ones are described in requirements:
rvm get stable
rvm reload
rvm requirements run
rvm reinstall 1.9.3

Resources