sparklemotion / nokogiri

Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
https://nokogiri.org/
MIT License
6.13k stars 897 forks source link

Support Ruby 2.2 on Windows #1256

Closed flavorjones closed 8 years ago

flavorjones commented 9 years ago

Currently (1.6.6.2) we only cross-compile for 1.9.3, 2.0.0 and 2.1.3.

belgoros commented 9 years ago

+1, have the same problem. I have a load error with the following nokogiri versions installed:

gem list nokogiri
nokogiri (1.6.6.2 x64-mingw32, 1.6.5 x64-mingw32)

Tried to load it irb:

C:\Users\XXXXXX\Documents\projects\ruby_drafts\lib>irb
irb(main):001:0> require 'nokogiri'
LoadError: cannot load such file -- nokogiri/nokogiri
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:29:in `rescue
 in <top (required)>'
        from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.6.2-x64-mingw32/lib/nokogiri.rb:25:in `<top (
required)>'
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
        from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
        from (irb):1
        from C:/Ruby22-x64/bin/irb:11:in `<main>'
irb(main):002:0>

OS: Windows 7 Pro Ruby: ruby 2.2.1p85 (2015-02-26 revision 49769) [x64-mingw32]

Any idea ? Thank you

flavorjones commented 9 years ago

Hello,

Thanks for asking this question. To be clear, we do not yet support window 2.2, as mentioned on the mailing list and in this issue. "+1"s are not necessary. :)

belgoros commented 9 years ago

ok, thank you.

richpeck commented 9 years ago

untitled

I think it works on my system (Win7 x64, Ruby 2.2.1)

altmind commented 9 years ago

that is so annoying. any timelines/plans to fix that? maybe there are some way/hack to alleviate the problem?

marutosi commented 9 years ago

I think Nokogori team should release new version including #1266, if MinGW Ruby 2.2 supporting takes long time.

richpeck commented 9 years ago

You could try http://stackoverflow.com/questions/28985328/rubyinstaller-2-2-1-and-rails-rake-cannot-load-nokogiri/29196632#29196632

guppygames commented 9 years ago

@richpeck: I tried your suggestion to compile nokogiri, but I got error iconv.h not found in mkmf.log, did exact setup as your example command. Any thoughts?

billmurrin commented 9 years ago

In order for me to get it to work, I had to download the following packages from XMLSoft

I extracted the packages and copied the binaries into my Ruby bin directory (So I didn't have to edit my PATH)

After that, I ran the following to install the nokogiri gem successfully

gem install nokogiri -- --use-system-libraries --with-iconv-config=C:/Ruby22/bin --with-xml2-config=C:/Ruby22/bin --with-xslt-config=C:/Ruby22/bin

Lastly, I had to edit the file "\Ruby22\lib\ruby\gems\2.2.0\specifications\nokogiri-1.6.6.2-x86-mingw32.gemspec" and change:

  s.require_paths = ["lib/"]

to

  s.require_paths = ["lib/nokogiri"]

I am new to Rails and this isn't going quite as "easy" as the tutorials, but I guess I have been through worse... :)

UPDATE: This didn't quite work as it seemed that nearly every library was generating an error after I tried to start

rails server
ailjushkin commented 9 years ago

Windows brings quite an installation hell dealing with ported linux tools... Concurrency is bad thing sometimes, good instruments being developed within one environment become non-maintainable when ported to another one... Thank you for all your work, guys,

I'm also waiting for updates by this problem. Thanks.

amnonkhen commented 9 years ago

@billmurrin Thanks for the detailed instructions. I still cannot get nokogiri to run on Windows with Ruby 2.2 (I tried 2.2.2). When you say

... copied the binaries into my Ruby bin directory ...

do you mean the dll and exe files?

Could you get a simple Ruby file with the following require statement to work?

require 'nokogiri'

Update: I got nokogiri working with Ruby 2.1.6.

davispuh commented 9 years ago

I wonder what's preventing Nokogiri to be built for Ruby 2.2 on Windows? What's status, what are blockers?

amnonkhen commented 9 years ago

It is indeed strange. I downgraded to Ruby 2.1 and it worked. I could live with this downgrade, since all I needed was a scraping task with Mechanize & Nokogiri. Amnon

On Tue, May 12, 2015 at 7:10 PM, Dāvis notifications@github.com wrote:

I wonder what's preventing Nokogiri to be built for Ruby 2.2 on Windows? What's status, what are blockers?

— Reply to this email directly or view it on GitHub https://github.com/sparklemotion/nokogiri/issues/1256#issuecomment-101332895 .

marutosi commented 9 years ago

Rails 5 requires Ruby 2.2.2, so we cannot run Rails 5 on Windows without this issue fixing. https://github.com/rails/rails/pull/19753

toncid commented 9 years ago

+1

Any updates on Ruby v2.2 support for Windows?

ccoenen commented 9 years ago

Same here. Is there anything we can do to help?

knu commented 9 years ago

Considering a cross-build issue has been addressed on the Ruby side and there's a PR for the build environment that works, I think all we need to do is release a new version. /cc @flavorjones

adrianwtx90 commented 9 years ago

I have the same error and just wanting to pick up Ruby on Rails.

Would it be better for me to remove everything and get 2.0.0 instead?

ccoenen commented 9 years ago

@adrianwtx90 for now, ruby 2.1 or ruby 2.0 would solve your problem. Other people have reported that nokogiri worked well on windows with ruby 2.1.

If you have the choice of 32 bit vs. 64 bit, i'd recommend 32 bit on windows. There are some gems with problems with 64 bit builds (net-ssh, for example; nokogiri in earlier versions), so you'd likely just run into the next problem.

Startouf commented 9 years ago

This issue should remain open ?

toncid commented 9 years ago

I guess so, there isn't a solution for Ruby 2.2 yet.

miaf commented 9 years ago

So there is no way for windows developers for Ruby 2.2 ? I am using Windows 8

toncid commented 9 years ago

Not that I'm aware of...

fera2k commented 9 years ago

I think the only solution for developers to be up to date with Ruby development is if you use Vagrant =)

ram-devsecops commented 9 years ago

We are having same issue, is this gonna be fixed soon?

miaf commented 9 years ago

The previous version Ruby 2.1 is working well. But does not support some features Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install

= 1.9.2 : nothing to do! Yay!

toncid commented 9 years ago

@knu has already mentioned that there are possible fixes in place. Thoughts?

flavorjones commented 9 years ago

The only blocker is finding the time to build the release, which is a bit time-consuming. I hope to do this in the next day or so.

RailsCod3rFuture commented 9 years ago

I can't wait until you release the next build for windows ruby 2.2 - My rails console is crying without it.

jmthomas commented 9 years ago

For you rails Windows devs keep in mind that sqlite also doesn't yet support Ruby 2.2 but does support 2.1: https://groups.google.com/forum/#!topic/sqlite3-ruby/cNqvONJmocU. So be prepared to get another DB running as well.

vitidev commented 9 years ago

jmthomas c:>ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32] c:>irb irb(main):001:0> require 'sqlite3' => true

richww commented 9 years ago

Any update on potential windows 2.2 build?

larskanis commented 9 years ago

@richww If you want to help, you could try this: https://github.com/sparklemotion/nokogiri/pull/1302

pabloh commented 9 years ago

+1, I really need this.

bboylilshaw commented 9 years ago

when are you gonna release 1.6.7? I really need this fix.

kymoeller commented 9 years ago

+1, need this as well

larskanis commented 9 years ago

You can build your own nokogiri gems for Rubyinstaller x86/x64 on Windows-x64 by using https://github.com/sparklemotion/nokogiri/pull/1302 as long as 1.6.7 isn't released. Install boot2docker for Windows and do this:

  git clone https://github.com/larskanis/nokogiri
  cd nokogiri
  git checkout make-use-of-rake-compiler-dock
  bundle
  rake gem:windows

It then takes a while to download and build everything, but in the end there should be some gems in the pkg directory for install.

Please leave a comment, if it works for you!

jonerer commented 9 years ago

+1

RailsCod3rFuture commented 9 years ago

+1

virvit commented 9 years ago

@larskanis It can't find docker even it was installed and running :(

WARNING: cross compilation not available: No MinGW tools or unknown setup platform? rake-compiler-dock bash -c "bundle && rake cross native gem MAKE='nice make -jnproc' RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2" Get http://127.0.0.1:2375/v1.19/version: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refuse d it.. Are you trying to connect to a TLS-enabled daemon without TLS? rake aborted! RakeCompilerDock::DockerIsNotAvailable: Docker is not available C:/virvit/2/nokogiri/Rakefile:358:in `block in <top (required)>' Tasks: TOP => gem:windows (See full trace by running task with --trace)

Docker is not available. Please download and install boot2docker: https://github.com/boot2docker/windows-installer/releases

Then execute 'boot2docker start' and follow the instuctions

larskanis commented 9 years ago

@virvit you must call "boot2docker start"and set the environment variables, that it prints, before calling "rake gem:windows".

SylvainHunault commented 9 years ago

Hi larskanis,

I have an error similar to virvit's and my variables are set correctly when I do "boot2docker".

My error : WARNING: cross compilation not available: No MinGW tools or unknown setup platform? rake-compiler-dock bash -c "bundle && rake cross native gem MAKE='nice make -j'nproc' RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2" An error occurred trying to connect : Get https://192.168.59.103:2376/v1.19/version: x509: certificate is valid for 127.0.0.1, 10.0.2.15, not 192.168.103 rake aborted ! RakeCompilerDock::DockerIsNotAvailable: Docker is not available C:/wwww/2/nokogiri/Rakefile:358:in `block in ' <top >' Tasks: TOP => gem:windows (See full trace by running task with --trace)

Docker is not available. Please download and install boot2docker: https://github.com/boot2docker/windows-installer/releases

Then execute 'boot2docker start' and follow the instuctions

As far as I understand, the IP is not correct. But I do not know where I can change it. However the instructions of boot2docker ask me to set DOCKER_HOST=tcp://192.168.59.103:2376 If I change 192.168.59.103:2376 by 127.0.0.1:2376, I obtain exactly the same message as virvit.

Do you have any idea of what is happening ?

virvit commented 9 years ago

I've found that you need to put 192.168.59.103 boot2docker into hosts file + set ENV variables. Then it works.

SylvainHunault commented 9 years ago

It do not undertand which hosts file you are refering to.

lmayorga1980 commented 9 years ago

:+1:

virvit commented 9 years ago

windows/system32/drivers/etc/hosts

SylvainHunault commented 9 years ago

The commands of larskanis finally worked. I needed to change the require path for nokogiri specification to lib/nokogiri.

However, I am still stuck with rails, getting loofah cannot load such file -- nokogiri.

Thanks to all ^^

paulgrant999 commented 9 years ago

deleted my comments as it is quite likely it is a virtual box issue. ;) VERY irritating way to discover a known problem. Got the so's and the gem; gem installed with no issues. Resolved all problems and rails is loading. New problems include bcrypt && sqlite3 (both of which have the same issue i.e. require cross compilation); sqlite3 you can dodge by using different db, bcrypt? looks like a cross-compile will be necessary...

jonerer commented 9 years ago

If one of you guys manage to make a build, do you think you could help @flavorjones prepare a release through a pull request (if that even works)? You would have my eternal gratitude ^^,

vladimmi commented 9 years ago

The only blocker is finding the time to build the release, which is a bit time-consuming. I hope to do this in the next day or so.

14 days ago... Usual thing in open-source but it's sad anyway.