Open robrenard opened 9 years ago
yep me too
I don't have a Windows machine so I cant fix and test this myself, but here's a possible fix:
The problem seems to be that the GNU_CHAIN
constant is undefined. It is being used here in the extconf.rb file.
I searched around and found that theGNU_CHAIN
constant is some sort of a convention used for denoting shared libraries (?).
If you'll see this code here, they've initialized GNU_CHAIN
in a particular way and used it below in the EXACT same manner as rbczmq uses it.
Copying the GNU_CHAIN initialization to rbczmq's extconf might solve the issue. Of course someone with a Windows machine needs to do it.
If I just change extconf.rb locally from a downloaded rbczmq gem sources, how could I properly install it from this sources? And will iruby use it and not try to download? P.S. My ruby knowledge is rather low to be sure about such things. I've only need iruby installed. Thanks
Yes you can. Just don't change the versions. It'll automatically use the local gem.
After you make the changes run rake compile
and then rake install
. That should install the required changes. Btw if the fix works I'd recommend you send them a PR.
The problem im having is that the windows.h and winsock.h files aren't being found, any idea where they should be? This is when I run rake compile
@v0dro , ok, here is what I have now. I've modified extconf.rb. I've copied code declaring GNU_CHAIN:
if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/
GNU_CHAIN = $1 == 'mingw'
OS_WIN32 = true
add_define "OS_WIN32"
else
GNU_CHAIN = true
OS_UNIX = true
add_define 'OS_UNIX'
add_define "HAVE_KQUEUE" if have_header("sys/event.h") and have_header("sys/queue.h")
end
After that I tried to rake compile, but it failed because there was no add_define method. I've copied it also:
def add_define(name)
$defs.push("-D#{name}")
end
The new try of rake compile gives me stacktrace:
cd tmp/x64-mingw32/rbczmq_ext/2.1.5
.../dev/Ruby21-x64/bin/ruby.exe -I. ../../../../ext/rbczmq/extconf.rb
checking for windows.h... *** ../../../../ext/rbczmq/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=../../../../ext/rbczmq
--curdir
--ruby=d:/dev/Ruby21-x64/bin/ruby
.../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:1067:in `block in have_header'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from .../dev/Ruby21-x64/lib/ruby/2.1.0/mkmf.rb:1066:in `have_header'
from ../../../../ext/rbczmq/extconf.rb:39:in `block in check_heads'
from ../../../../ext/rbczmq/extconf.rb:39:in `each'
from ../../../../ext/rbczmq/extconf.rb:39:in `all?'
from ../../../../ext/rbczmq/extconf.rb:39:in `check_heads'
from ../../../../ext/rbczmq/extconf.rb:64:in `<main>'
rake aborted!
Command failed with status (1): [.../dev/Ruby21-x64/bin/ruby.exe -I. ../../....]
Tasks: TOP => compile => compile:x64-mingw32 => compile:rbczmq_ext:x64-mingw32 => copy:rbczmq_ext:x64-mingw32:2.1.5 => tmp/x64-mingw32/rbczmq_ext/2.1.5/rbczmq_ext.so => tmp/x64-mingw32/rbczmq_ext/2.1.
5/Makefile
(See full trace by running task with --trace)
You're not checking for windows.h.
See this code: https://www.omniref.com/ruby/gems/MattHulse-eventmachine/0.12.10/symbols/Object::GNU_CHAIN#line=40
Also, read that whole file on omniref, I think it should have solutions to most of your problems.
The original code is checking for windows.h. Problem is, the method itself fails. I have no idea why, I'm new to ruby.
If I go to irb, and type
require 'mkmf'
have_header('windows.h')
irb(main):002:0> have_header('windows.h')
checking for windows.h... RuntimeError: The compiler failed to generate an execu
table file.
You have to install development tools first.
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:434:in `try_do'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1038:in `block in have_header'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:889:in `block in checking_for'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:888:in `checking_for'
from C:/Ruby200-x64/lib/ruby/2.0.0/mkmf.rb:1037:in `have_header'
from (irb):2
from C:/Ruby200-x64/bin/irb:12:in `<main>'
My ruby is ruby 2.0.0p643 (2015-02-25) [x64-mingw32]
and I have installed the devkit DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe
to C:\DevKit. I added C:\DevKit\bin
and C:\DevKit\mingw\bin
to my system path, where I also have C:\Ruby200-x64\bin
.
I updated to the latest Ruby (rubyinstaller-2.2.3-x64), and with this the have_header('windows.h') works. But it still doesn't work. After adding a portion of code to initialize GNU_CHAIN:
C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\rbczmq-1.7.9\ext\rbczmq>ruby extconf.rb
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
"./autogen.sh"
ZeroMQ autogen failed!
*** 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:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-kernel32lib
--without-kernel32lib
--with-rpcrt4lib
--without-rpcrt4lib
--with-gdi32lib
--without-gdi32lib
--with-system-libs
--without-system-libs
This looks like it's not able to install ZeroMQ. Have you installed all the dependencies?
@methodmissing could you please list out any ZeroMQ dependencies? Also, will it be possible for you to fix this? We need this gem for iruby, and the anomaly in Windows is causing Windows users to move away.
I've tried pretty much everything I could, including building ZeroMQ from source, etc. Everything ended up failing.
Hi guys, I can take a look later today. Apologies for the delay - been really busy.
Great news! Thanks for handling it!
+1
@methodmissing: did you get a chance to look at it? If so, will it be an easy/quick fix? I'm trying to see if I should wait for iruby to work or I should start building python bindings in order to be able to use IPython.
Thanks a lot, I hope you enjoyed the weekend.
Any news on this topic ? I'm still getting the uninitialized constant GNU_CHAIN (NameError)
OK, I built the native extension and installed rbczmq-1.7.9 successfully.
In my environment (ruby2.2.3p173 x64-mingw32), GNU_CHAIN
is not defined on top level and also its dev-tool do not recognize the option -EHs
.
I think these lines (https://github.com/methodmissing/rbczmq/blob/e35825f582807241466b286338aa9e2af9fca084/ext/rbczmq/extconf.rb#L51-L56) can be removed when trying on mingw32, but I don't know how they work on other environments.
To install this gem to Windows you may have to install VS2012 or up and build zeromq and czmq manually with it. Some settings written in *.sln
should be also changed manually.
I will show these changes and build-instructions in my repository :)
Could you post a link to the instructions when you have written them please @domitry ?
@jmarrec I wrote in #52 but it still doesn't work … anyway build errors disappeared and we can go next, maybe.
@jmarrec BTW now IRuby works well with ffi-rzmq on Windows so if you'd like to try it just run git pull https://github.com/SciRuby/iruby.git
, build and install it.
The detailed installation instruction is written in README.md.
ffi-rzmq is listed as abandoned unfortunately. It would seem the best choice though. So what are Ruby Windows devs actually supposed to use? :(
I have this problem in almost 2018 for the record.
I couldn't install rbczmq gem on my PC.
Here follows the gem_make.out message:
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150710-8684-1bvpd0e.rb extconf.rb checking for windows.h... yes checking for winsock.h... yes checking for main() in -lkernel32... yes checking for main() in -lrpcrt4... yes checking for main() in -lgdi32... yes * 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:/Ruby22-x64/bin/$(RUBY_BASE_NAME) --with-kernel32lib --without-kernel32lib --with-rpcrt4lib --without-rpcrt4lib --with-gdi32lib --without-gdi32lib extconf.rb:49:in `': uninitialized constant GNU_CHAIN (NameError)
extconf failed, exit code 1
Thank you.