Having trouble installing libxml-ruby on windows - ruby-on-rails

First of all thank you for your time.
I've been having some trouble installing libxml-ruby on my windows 8 OS. I have ruby installed and want to use libxml specifically to modify xmls because other members of my team have already started with libxml. The problem is that they were using linux and I'm on windows. I could try to put everything on a vm but I don't think I should need to.
They had issues installing on linux too but their solution and problem was different from mine.
C:\dev\school\ece450\MyBPM>gem install libxml-ruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing libxml-ruby:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb
checking for socket() in -lsocket... no
checking for gethostbyname() in -lnsl... no
checking for atan() in -lm... yes
checking for inflate() in -lz... no
checking for inflate() in -lzlib... no
checking for inflate() in -lzlib1... no
checking for inflate() in -llibz... 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby200/bin/ruby
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/
--with-socketlib
--without-socketlib
--with-nsllib
--without-nsllib
--with-mlib
--without-mlib
--with-zlib
--without-zlib
--with-zliblib
--without-zliblib
--with-zlib1lib
--without-zlib1lib
--with-libzlib
--without-libzlib
extconf failure: need zlib
extconf failed, exit code 1
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/libxml-ru
by-2.7.0 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/extensions/x86-mingw32/2.0.0/li
bxml-ruby-2.7.0/gem_make.out
I have tried installing zlib (binaries) and pointing to the zlib binary.
That didn't really help.
So now I'm googling :)

Alright, I finally got sick of running into this issue myself (and eventually giving up and moving to a VM). So I spent some time fiddling around and finally got a reliable way to get install Ruby (2.2.3 as of now) and libxml-ruby on Windows.
Download and install the latest Ruby for your architecture from rubyinstaller.org
Download the matching DevKit from the same page
Extract the DevKit and follow the setup instructions, particularly step 4
Copy zlib1.dll from <ruby_install_dir>/bin to <ruby_install_dir>/lib
Download the MinGW iconv package and extract everything in mingw64/lib to <ruby_install_dir>/lib
Download libxml for windows (see below). Extract the contents of its lib into your <ruby_install_dir>/lib and the contents of its include directory into <ruby_install_dir>/include
With luck, gem install libxml-ruby should now work, but odds are you'll probably have to try some different arguments to the installer. Ultimately I needed gem install libxml-ruby -- with-xml2-include=C:\Ruby22-x64\include\libxml2 --with-iconv-include=C:\Ruby22-x64\include
Since StackOverflow only lets me post two links in an answer;
I found a 64 bit version of libxml for windows at
https://forge.imag.fr/frs/?group_id=184&release_id=320
Another possibility is
ftp://ftp.zlatkovic.com/libxml/64bit/
but neither seem to be an official source, so no guarantees that it'll be around when you read this ;)

Nevermind.
I went on a journey through the internet and decided just to use a VM and run ruby on linux. Yay 1 hour setup....
Here's where my journey ended
http://rubyonwindowsguides.github.io/book/ch02-05.html
Thanks for reading.

Related

Rails - Trouble installing capybara-webkit

I have a Rails 5 application that has several forms contained in bootstrap modals. Capybara is having trouble reading the modal content. From reading several other stack overflow articles, it seems I need to install the capybara-webkit gem. However, I am having trouble installing it.
On my initial install, I got an error that said:
Command 'qmake ' not available
extconf failed, exit code 1
Gem files will remain installed in
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.14.0 for inspection.
Results logged to
An error occurred while installing capybara-webkit (1.14.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.14.0'` succeeds before bundling.
Looking around a bit, it seems I need to install QT. So I tried to install using the instructions from this article: https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit
I am on OS X El Capitan, so I ran:
brew install qt#5.5
Then I typed this into the command line, per the instructions (I believe. This may be where I messed up):
echo 'export PATH="$(brew --prefix qt#5.5)/bin:$PATH"' >> ~/.bashrc
I tried installing the gem again, and got the exact same problem:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.14.0
/Users/johnseabolt/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20170803-82842-1br8b1h.rb extconf.rb
*** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/johnseabolt/.rbenv/versions/2.3.1/bin/$(RUBY_BASE_NAME)
--with-gl-dir
--without-gl-dir
--with-gl-include
--without-gl-include=${gl-dir}/include
--with-gl-lib
--without-gl-lib=${gl-dir}/lib
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
Command 'qmake ' not available
extconf failed, exit code 1
Gem files will remain installed in
/Users/johnseabolt/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/capybara-webkit-1.14.0 for inspection.
Results logged to
An error occurred while installing capybara-webkit (1.14.0), and Bundler cannot continue.
Make sure that `gem install capybara-webkit -v '1.14.0'` succeeds before bundling.
I can't get this working? Help!
With the echo example you've just added the export to your .bashrc - You still need to make sure that is loaded into the current PATH environment variable though. Easiest way to do that is to close the current shell and open a new one, however I've generally found it easier to just go with the
brew link --force qt#5.5
All this being said, capybara-webkit has become pretty outdated in its JS support and requires transpiling and polyfilling for testing most modern apps. As a beginner to testing JS dependent apps with Capybara you're probably better off using selenium with chrome - https://github.com/teamcapybara/capybara#configuring-and-adding-drivers -
instead of capybara-webkit

Error when installing rails, failed to build gem native extension

I'm following this Go Rails tutorial and I'm running into trouble when I reach the step to install rails. I'm calling
sudo gem install rails -v 5.0.1
in the terminal and getting this error:
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/nokogiri-1.7.0.1/ext/nokogiri
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170302-50105-1af2foa.rb extconf.rb
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... no
zlib is missing; necessary for building libxml2
*** 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:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.4.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/nokogiri-1.7.0.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/nokogiri-1.7.0.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/nokogiri-1.7.0.1/gem_make.out
I'm not really sure what to make of this. I've tried reinstalling uninstalling and reinstalling zlib but it didn't seem to change anything. I'm on OS X Sierra version 10.12.3 by the way.
Solved by this thread using
sudo gem install rails -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/

extconf.rb failed (Ruby On Rails)

Im new to ruby and rails. I've set up ruby 2 on rails 4 successfully (On windows 7). I cloned a ruby on rails based git project (thingspeak - https://github.com/iobridge/thingspeak/blob/master/README.textile). Using the command line I went into the project directory and ran "bundle install". A few bundles got downloaded and installed and then I got the following error -
::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
c:/row/Ruby200/bin/ruby.exe extconf.rb
checking for CLOCK_MONOTONIC in time.h... yes
checking for clockid_t in time.h... yes
checking for clock_gettime() in -lrt... no
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for poll() in poll.h... no
checking for getaddrinfo() in sys/types.h,sys/socket.h,netdb.h... no
getaddrinfo required
*** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=c:/row/Ruby200/bin/ruby
--with-rtlib
--without-rtlib
--with-nsllib
--without-nsllib
--with-socketlib
--without-socketlib
Gem files will remain installed in c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/kgio-
2.8.1 for inspection.
Results logged to c:/row/Ruby200/lib/ruby/gems/2.0.0/gems/kgio-2.8.1/ext/kgio/ge
m_make.out
An error occurred while installing kgio (2.8.1), and Bundler cannot continue.
Make sure that `gem install kgio -v '2.8.1'` succeeds before bundling.
Any ideas on what it means and how to fix it?
The kgio gem which fails to compile here does not work on Windows. It could work if you comment the respective line in the Gemfile but could fail in various other places.
Generally, the Rails app you want to install doesn't seem to be tested on Windows at all, so you might instead want to use a better supported OS to install it. The README mentions Ubuntu here.

Can't bundle/install Kgio Error

I can't seem to install kgio with my app, every time I do bundle install. I get this error ! Can anyone help me? I have tried re bundling like 5 times already.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for CLOCK_MONOTONIC in time.h... no
checking for CLOCK_MONOTONIC() in time.h... no
checking for clockid_t in time.h... no
checking for clock_gettime() in -lrt... no
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for poll() in poll.h... no
checking for getaddrinfo() in sys/types.h,sys/socket.h,netdb.h... no
getaddrinfo required
*** 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:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby1.9.3/bin/ruby
--with-rtlib
--without-rtlib
--with-nsllib
--without-nsllib
--with-socketlib
--without-socketlib
Actually, the answer is that you can't use kgio with windows. I spent 3 hours sweating through the other answer here before finding that out. Kgio needs a unix-like environment according to it's developer.
You are probably missing required libraries.
Also from RubyInstaller Wiki
This failure is due to the native gem compile/install process using a version of libiconv-2.dll other than the one integrated into the DevKit due to how Windows searches for DLLs
This can be worked around by searching your computer for the file libiconv-2.dll and renaming, deleting, or otherwise moving any found instances out of the way and re-running the native gem install process or in your case Bundle Install
It is recommended that if you don’t know why or what put the libiconv-2.dll file in the directory in which you found it, that you move it back after you compile whatever gems you need. This will possibly prevent other applications from breaking.
EDIT:
The kgio gem only builds and runs on Unix like systems (http://bogomips.org/kgio/) It uses functions which are not natively available on Windows.
If you are trying to use Unicorn, then you just need to replace the webserver.
Give Thin a try. Add the following lines to your Gemfile:
gem 'thin'

Problem installing LibCurl + LibXML + FeedZirra on Windows XP

I am rails newbie. I am working on Windows XP.
I have this version of ruby.
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
I have Rails 2.3.8 installed.
I am trying to install feedzirra trying every possible way after watching the Rails Cast 168.
First I tried to install using gem install pauldix-feedzirra. I got this error.
C:\Ruby>gem install pauldix-feedzirra
Building native extensions. This could take a while...
ERROR: Error installing pauldix-feedzirra:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
checking for curl-config... no
checking for main() in -lcurl... 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:12: Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/taf2-curb-0.5.
4.0 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/taf2-curb-0.5.4.0/ext/gem_make.
out
Next I tried gem install curb. I found this on PaulDix FeedZirra page where he had suggested us that Todd Fisher is working on Ruby binding of libcurl which is called curb
Now, I am getting this error
C:\Ruby>gem install curb
Building native extensions. This could take a while...
ERROR: Error installing curb:
ERROR: Failed to build gem native extension.
C:/Ruby/bin/ruby.exe extconf.rb
"-g -O2 -DFD_SETSIZE=256 $(cflags)"
checking for curl-config... no
checking for main() in -lcurl... 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.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby/bin/ruby
--with-curl-dir
--without-curl-dir
--with-curl-include
--without-curl-include=${curl-dir}/include
--with-curl-lib
--without-curl-lib=${curl-dir}/lib
--with-curllib
--without-curllib
extconf.rb:19: Can't find libcurl or curl/curl.h (RuntimeError)
Try passing --with-curl-dir or --with-curl-lib and --with-curl-include
options to extconf.
Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/curb-0.7.8 for
inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/curb-0.7.8/ext/gem_make.out
When the error said its because it cant find libcurl or curl/curl.h then I did some googling about it and I found link to Download Wizard. The best option for a rails newbie is to go with curl executable (as suggested ascross various forums and articles) I did that. Extracted the file. Installed the exe file. Now I thought the libcurl problem is solved. But??
Ok, now inorder to install feedzirra, i need to install libxml too. So with a little bit of googling i ended up here at Libxml ruby forge, downloaded the libxml-ruby-1.1.3 gem and placed it in C:\Ruby\bin folder.
Now, thinking that all set, I am ready to go to learn feed parsing, i enter gem install pauldix-feedzirra. I get the same error "Can't find libcurl or curl/curl.h" and the same old list what i got earlier.
For the past 3 days, I am just trying to install this. No luck!
Could someone help me fix this? Basic steps. Please think I dont know how to operate windows. Please go to that basic level when you talk problem fixing terminology and help me to fix this problem.
Looking forward for your help and support in a big way.
Thanks in advance.
Curb Installed
Follow instrictions of rubyinstaller and sakaiproject
You would be able to install curb in no time!
yes, curb she will be install in no time. but not taf2-curb. and taf2-curb - this one need for feedzirra. Look on my fighting with taf2-curb, it wouldnt compile in windows for reason.
BTW, i switched to feedtosis, had some active support issues with feedzirra on edge, do not have time to resolve it.

Resources