Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on Windows 7 x64 with ruby 2.0.0p195 (2013-05-14) [i386-mingw32] #31

Closed
Sauraus opened this issue Jul 12, 2013 · 18 comments
Closed

Comments

@Sauraus
Copy link

Sauraus commented Jul 12, 2013

C:\rbxops\Vagrant> gem install nio4r
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing nio4r:
ERROR: Failed to build gem native extension.

C:/Ruby/Ruby200/bin/ruby.exe extconf.rb

checking for rb_thread_blocking_region()... yes
checking for sys/select.h... no
checking for poll.h... no
checking for sys/epoll.h... no
checking for sys/event.h... no
checking for port.h... no
checking for sys/resource.h... no
creating Makefile

make
generating nio4r_ext-i386-mingw32.def
compiling monitor.c
In file included from nio4r.h:10:0,
from monitor.c:6:
c:/Ruby/Ruby200/include/ruby-2.0.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
In file included from nio4r.h:11:0,
from monitor.c:6:
libev.h:5:0: warning: "FD_SETSIZE" redefined [enabled by default]
:0:0: note: this is the location of the previous definition
monitor.c: In function 'NIO_Monitor_initialize':
monitor.c:103:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
monitor.c:103:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
monitor.c:103:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
monitor.c: At top level:
monitor.c:30:13: warning: 'NIO_Monitor_callback' declared 'static' but never defined [-Wunused-function]
compiling nio4r_ext.c
In file included from nio4r.h:10:0,
from nio4r_ext.c:6:
c:/Ruby/Ruby200/include/ruby-2.0.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
In file included from nio4r.h:11:0,
from nio4r_ext.c:6:
libev.h:5:0: warning: "FD_SETSIZE" redefined [enabled by default]
:0:0: note: this is the location of the previous definition
In file included from nio4r_ext.c:7:0:
../libev/ev.c:474:48: warning: "/" within comment [-Wcomment]
In file included from ../libev/ev.c:1005:0,
from nio4r_ext.c:7:
../libev/ev_win32.c: In function 'ev_pipe':
../libev/ev_win32.c:84:3: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
In file included from nio4r_ext.c:7:0:
../libev/ev.c: At top level:
../libev/ev.c:1258:31: warning: 'ev_default_loop_ptr' initialized and declared 'extern' [enabled by default]
../libev/ev.c: In function 'array_nextsize':
../libev/ev.c:1367:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
../libev/ev.c: In function 'fd_reify':
../libev/ev.c:1515:15: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'evpipe_init':
../libev/ev.c:1815:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'ev_feed_signal':
../libev/ev.c:1951:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
In file included from ../libev/ev.c:2091:0,
from nio4r_ext.c:7:
../libev/ev_select.c: In function 'select_modify':
../libev/ev_select.c:85:5: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev_select.c: At top level:
../libev/ev_select.c:274:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
../libev/ev_select.c:274:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
../libev/ev_select.c:303:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
../libev/ev_select.c:303:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
In file included from nio4r_ext.c:7:0:
../libev/ev.c:2107:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
../libev/ev.c:2107:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]
../libev/ev.c: In function 'loop_init':
../libev/ev.c:2309:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:2309:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:2309:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:2312:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:2312:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:2312:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:2313:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'ev_loop_destroy':
../libev/ev.c:2347:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'loop_fork':
../libev/ev.c:2457:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'verify_watcher':
../libev/ev.c:2508:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:2511:5: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'verify_heap':
../libev/ev.c:2521:7: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:2522:7: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:2523:7: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'array_verify':
../libev/ev.c:2534:7: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_verify':
../libev/ev.c:2552:5: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:2559:9: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:2560:9: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'timers_reify':
../libev/ev.c:2737:15: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'periodics_reify':
../libev/ev.c:2801:15: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:2788:11: warning: unused variable 'feed_count' [-Wunused-variable]
../libev/ev.c: In function 'ev_backend_poll':
../libev/ev.c:2946:1: warning: no return statement in function returning non-void [-Wreturn-type]
../libev/ev.c: In function 'ev_run':
../libev/ev.c:2963:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:3120:9: warning: 'rb_thread_blocking_region' is deprecated (declared at c:/Ruby/Ruby200/include/ruby-2.0.0/ruby/intern.h:835) [-Wdeprecated-declarations]
../libev/ev.c:3134:13: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:3134:13: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_io_start':
../libev/ev.c:3306:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:3307:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_io_stop':
../libev/ev.c:3328:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_timer_start':
../libev/ev.c:3348:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_timer_stop':
../libev/ev.c:3376:5: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_periodic_start':
../libev/ev.c:3438:7: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_periodic_stop':
../libev/ev.c:3470:5: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c: In function 'ev_signal_start':
../libev/ev.c:3507:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:3510:3: warning: left-hand operand of comma expression has no effect [-Wunused-value]
In file included from nio4r_ext.c:7:0:
../libev/ev.c: In function 'ev_stat_start':
../libev/ev.c:3962:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:3962:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:3962:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:3962:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:3963:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'ev_stat_stop':
../libev/ev.c:3995:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'ev_embed_start':
../libev/ev.c:4197:5: warning: left-hand operand of comma expression has no effect [-Wunused-value]
../libev/ev.c:4198:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4198:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4198:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4203:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4206:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4206:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4206:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4207:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4210:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4210:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4210:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: In function 'ev_once':
../libev/ev.c:4420:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4420:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4420:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4427:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4427:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4427:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c:4430:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
../libev/ev.c: At top level:
../libev/ev.c:4546:27: warning: "/
" within comment [-Wcomment]
../libev/ev.c:4547:27: warning: "/" within comment [-Wcomment]
In file included from nio4r_ext.c:7:0:
../libev/ev.c:1622:1: warning: 'fd_rearm_all' defined but not used [-Wunused-function]
compiling selector.c
In file included from nio4r.h:10:0,
from selector.c:6:
c:/Ruby/Ruby200/include/ruby-2.0.0/ruby/backward/rubyio.h:2:2: warning: #warning use "ruby/io.h" instead of "rubyio.h" [-Wcpp]
In file included from nio4r.h:11:0,
from selector.c:6:
libev.h:5:0: warning: "FD_SETSIZE" redefined [enabled by default]
:0:0: note: this is the location of the previous definition
In file included from selector.c:7:0:
c:/Ruby/Ruby200/include/ruby-2.0.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
selector.c: In function 'NIO_Selector_allocate':
selector.c:84:5: warning: implicit declaration of function 'pipe' [-Wimplicit-function-declaration]
selector.c:94:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
selector.c:94:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
selector.c:94:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
selector.c:99:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
selector.c:99:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
selector.c:99:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
selector.c: In function 'NIO_Selector_synchronize':
selector.c:159:11: warning: variable 'current_thread' set but not used [-Wunused-but-set-variable]
selector.c: In function 'NIO_Selector_deregister_synchronized':
selector.c:235:11: warning: unused variable 'monitor_args' [-Wunused-variable]
selector.c:234:21: warning: unused variable 'interests' [-Wunused-variable]
selector.c: In function 'NIO_Selector_select':
selector.c:262:20: warning: unused variable 'array' [-Wunused-variable]
selector.c: In function 'NIO_Selector_select_synchronized':
selector.c:280:9: warning: unused variable 'i' [-Wunused-variable]
selector.c: In function 'NIO_Selector_close':
selector.c:385:5: warning: passing argument 2 of 'NIO_Selector_synchronize' from incompatible pointer type [enabled by default]
selector.c:157:14: note: expected 'VALUE (
)(VALUE )' but argument is of type 'VALUE ()(VALUE)'
selector.c:385:5: warning: passing argument 3 of 'NIO_Selector_synchronize' makes pointer from integer without a cast [enabled by default]
selector.c:157:14: note: expected 'VALUE ' but argument is of type 'VALUE'
selector.c: In function 'NIO_Selector_closed':
selector.c:401:5: warning: passing argument 2 of 'NIO_Selector_synchronize' from incompatible pointer type [enabled by default]
selector.c:157:14: note: expected 'VALUE (
)(VALUE )' but argument is of type 'VALUE ()(VALUE)'
selector.c:401:5: warning: passing argument 3 of 'NIO_Selector_synchronize' makes pointer from integer without a cast [enabled by default]
selector.c:157:14: note: expected 'VALUE ' but argument is of type 'VALUE'
linking shared-object nio4r_ext.so
c:/ruby/ruby200sdk/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: warning: cannot find entry symbol xport-all; defaulting to 0000000061741000
nio4r_ext.o: In function get_clock': C:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\nio4r-0.4.6\ext\nio4r/../libev/ev.c:1311: undefined reference toclock_gettime'
C:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\nio4r-0.4.6\ext\nio4r/../libev/ev.c:1311: undefined reference to clock_gettime' C:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\nio4r-0.4.6\ext\nio4r/../libev/ev.c:1311: undefined reference toclock_gettime'
C:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\nio4r-0.4.6\ext\nio4r/../libev/ev.c:1311: undefined reference to clock_gettime' C:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\nio4r-0.4.6\ext\nio4r/../libev/ev.c:1311: undefined reference toclock_gettime'
nio4r_ext.o:C:\Ruby\Ruby200\lib\ruby\gems\2.0.0\gems\nio4r-0.4.6\ext\nio4r/../libev/ev.c:1311: more undefined references to `clock_gettime' follow
collect2.exe: error: ld returned 1 exit status
make: *
* [nio4r_ext.so] Error 1

Gem files will remain installed in C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/nio4r-0.4.6 for inspection.
Results logged to C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/nio4r-0.4.6/ext/nio4r/gem_make.out
C:\rbxops\Vagrant> ruby -v
ruby 2.0.0p195 (2013-05-14) [i386-mingw32]
C:\rbxops\Vagrant>

@tarcieri
Copy link
Contributor

I don't have a Windows machine to test on/develop on or know much about Windows, so any assistance here is appreciated /cc @luislavena

@Sauraus
Copy link
Author

Sauraus commented Jul 12, 2013

I've narrowed down the problem to a missing lib reference in the Makefile for win32/mingw configs most likely pthread.

@Sauraus
Copy link
Author

Sauraus commented Jul 12, 2013

So the missing symbols are gone, but now its mingw32 which is being a pain:

linking shared-object nio4r_ext.so
c:/ruby/ruby200/sdk/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/lib/../lib/libpthread.dll.a: could not read symbols: Archive has no index; run ranlib to add one
collect2.exe: error: ld returned 1 exit status
make: *** [nio4r_ext.so] Error 1

Gem files will remain installed in C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/nio4r-0.4.6 for inspection.
Results logged to C:/Ruby/Ruby200/lib/ruby/gems/2.0.0/gems/nio4r-0.4.6/ext/nio4r/gem_make.out

oneclick/rubyinstaller#182

@luislavena
Copy link
Contributor

@tarcieri is there a chance you can update the embedded libev to version 4.15? That version contains a few fixes for Windows too.

The problem here is caused by mingw-w64 headers defining at some point HAVE_CLOCK_GETTIME, which I reported a bit ago to mingw-w64 project and should be fixed in their next release of headers.

In libev 4.15, there is no need for EV_SELECT_IS_WINSOCKET 1 in libev.h, so I ended doing this instead:

#ifdef _WIN32
#define EV_USE_MONOTONIC 0
#define EV_USE_REALTIME 0
#endif

(replacing existing block)

And no longer playing with FD_SETSIZE since it causes a redefinition warning (because is happening too late in the process) and Ruby 1.9.x already have it set to 2048.

With the above changes and libev 4.15, specs passes except for two pipe-related failures:

Finished in 2.78 seconds
43 examples, 2 failures, 4 pending

Failed examples:

rspec ./spec/support/selectable_examples.rb:23 # IO.pipe behaves like an NIO selectable does not select unwritable objects
rspec ./spec/nio/selector_spec.rb:68 # NIO::Selector timeouts waits for a timeout when selecting

Tested against:

  • ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
  • ruby 2.0.0p247 (2013-06-27) [x64-mingw32]

@tarcieri
Copy link
Contributor

@luislavena yeah I can, it's a little tricky because I modify libev to perform a GVL unlock

@luislavena
Copy link
Contributor

@tarcieri yeah, I saw it and did it manually, just saving all the HACKY comment blocks around 😉

There are lot of warnings and small issues related to Windows solved in it, that is why I was asking 😄

Thank you!

@tarcieri
Copy link
Contributor

@luislavena have this code somewhere? I'd be happy to merge it upstream.

The pipe-related failures might be a bit of a problem as nio4r uses pipes as a wakeup mechanism for selectors. Perhaps there's something similar we can use on Windows?

@luislavena
Copy link
Contributor

have this code somewhere? I'd be happy to merge it upstream.

local hack, not pushed anywhere. Will do it tonight if you want.

The pipe-related failures might be a bit of a problem as nio4r uses pipes as a wakeup mechanism for selectors. Perhaps there's something similar we can use on Windows?

I'll look into this, I remember having some issues with pipes and MRI but don't quite remember the specifics.

@mmisztal1980
Copy link

Hi, are there any news regarding this topic? I'm trying to install berkshelf which has this project as a dependency - but I'm failing.

Are there any workarounds?

@tarcieri
Copy link
Contributor

@luislavena can you post your local hack if nothing else? ;)

@Sauraus
Copy link
Author

Sauraus commented Jul 26, 2013

@mmisztal1980 don't use Ruby 2.x, I moved back to 1.9.3 and everything is just fine.

@mmisztal1980
Copy link

Tried that as well. Ruby 1.9.3 works

@luislavena
Copy link
Contributor

@tarcieri sorry, was a bit busy and forgot to commit and push.

I've open a pull request for this, please let me know your thoughts.

@chiefy
Copy link

chiefy commented Aug 2, 2013

+1, just ran into this on Windows 8 x64 w/ Ruby 2x64

@tarcieri
Copy link
Contributor

tarcieri commented Aug 3, 2013

@chiefy try nio4r master. Things should be fixed there.

Release forthcoming

@Sauraus
Copy link
Author

Sauraus commented Aug 5, 2013

@tarcieri super! :) thanks!

@chiefy
Copy link

chiefy commented Aug 6, 2013

@tarcieri thanks, i will give it a go.

@tarcieri tarcieri closed this as completed Aug 6, 2013
@tarcieri
Copy link
Contributor

tarcieri commented Aug 6, 2013

This is fixed on master. Release forthcoming, hopefully tonight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants