ph7 / system-timer

Reliable Ruby timeouts for M.R.I. 1.8
http://systemtimer.rubyforge.org
Other
75 stars 14 forks source link

SystemTimer gem does not install on Windows #2

Open ghazel opened 15 years ago

ghazel commented 15 years ago
S:\>gem install SystemTimer
Building native extensions.  This could take a while...
ERROR:  Error installing SystemTimer:
        ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb install SystemTimer
creating Makefile

nmake

Microsoft (R) Program Maintenance Utility   Version 6.00.9782.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        cl -nologo -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -MD -Zi -O2b2xg- -G6  -c -
Tcsystem_timer_native.c
system_timer_native.c
system_timer_native.c(17) : error C2061: syntax error : identifier 'original_mask'
system_timer_native.c(17) : error C2059: syntax error : ';'
system_timer_native.c(18) : error C2061: syntax error : identifier 'sigalarm_mask'
system_timer_native.c(18) : error C2059: syntax error : ';'
system_timer_native.c(19) : error C2079: 'original_signal_handler' uses undefined struct 'sigaction'
system_timer_native.c(20) : error C2079: 'original_timer_interval' uses undefined struct 'itimerval'
system_timer_native.c(30) : error C2143: syntax error : missing ')' before '*'
system_timer_native.c(30) : error C2143: syntax error : missing '{' before '*'
system_timer_native.c(30) : error C2059: syntax error : ')'
system_timer_native.c(37) : error C2079: 'timer_interval' uses undefined struct 'itimerval'
system_timer_native.c(46) : error C2065: 'SIG_BLOCK' : undeclared identifier
system_timer_native.c(46) : error C2065: 'sigalarm_mask' : undeclared identifier
system_timer_native.c(46) : error C2065: 'original_mask' : undeclared identifier
system_timer_native.c(57) : error C2224: left of '.sa_handler' must have struct/union type
system_timer_native.c(58) : error C2065: 'SIGALRM' : undeclared identifier
system_timer_native.c(73) : warning C4133: 'function' : incompatible types - from 'int *' to 'struct itimerval *'
system_timer_native.c(74) : warning C4133: 'function' : incompatible types - from 'int *' to 'struct itimerval *'
system_timer_native.c(75) : error C2065: 'ITIMER_REAL' : undeclared identifier
system_timer_native.c(81) : error C2224: left of '.it_value' must have struct/union type
system_timer_native.c(86) : error C2065: 'SIG_UNBLOCK' : undeclared identifier
system_timer_native.c(99) : error C2079: 'timer_interval' uses undefined struct 'itimerval'
system_timer_native.c(100) : error C2065: 'sigset_t' : undeclared identifier
system_timer_native.c(100) : error C2146: syntax error : missing ';' before identifier 'previous_sigalarm_mask'
system_timer_native.c(100) : error C2065: 'previous_sigalarm_mask' : undeclared identifier
system_timer_native.c(119) : warning C4133: 'function' : incompatible types - from 'int *' to 'struct itimerval *'
system_timer_native.c(125) : error C2224: left of '.it_value' must have struct/union type
system_timer_native.c(155) : error C2224: left of '.sa_handler' must have struct/union type
system_timer_native.c(162) : error C2224: left of '.sa_handler' must have struct/union type
system_timer_native.c(183) : error C2143: syntax error : missing ')' before '*'
system_timer_native.c(183) : error C2143: syntax error : missing '{' before '*'
system_timer_native.c(183) : error C2059: syntax error : ')'
system_timer_native.c(184) : error C2054: expected '(' to follow 'previous_mask'
system_timer_native.c(277) : error C2037: left of 'it_interval' specifies undefined struct/union 'itimerval'
system_timer_native.c(278) : error C2037: left of 'it_interval' specifies undefined struct/union 'itimerval'
system_timer_native.c(279) : error C2037: left of 'it_value' specifies undefined struct/union 'itimerval'
system_timer_native.c(280) : error C2037: left of 'it_value' specifies undefined struct/union 'itimerval'
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.

Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/SystemTimer-1.1.1 for inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/SystemTimer-1.1.1/ext/system_timer/gem_make.out

Trying to install from github:

S:\system-timer>rake install
(in S:/system-timer)
mkdir -p pkg
WARNING:  no author specified
WARNING:  no email specified
WARNING:  no homepage specified
WARNING:  no rubyforge_project specified
WARNING:  deprecated autorequire specified
  Successfully built RubyGem
  Name: SystemTimer
  Version: 1.1.1
  File: SystemTimer-1.1.1-x86-mswin32.gem
mv SystemTimer-1.1.1-x86-mswin32.gem pkg/SystemTimer-1.1.1-x86-mswin32.gem
gem install ./pkg/SystemTimer-1.1.1.gem
ERROR:  could not find gem ./pkg/SystemTimer-1.1.1.gem locally or in a repository
rake aborted!
Command failed with status (2): [gem install ./pkg/SystemTimer-1.1.1.gem...]
S:/system-timer/rakefile:25
(See full trace by running task with --trace)

Finally got it:

S:\system-timer>gem install ./pkg/SystemTimer-1.1.1-x86-mswin32.gem
Successfully installed SystemTimer-1.1.1-x86-mswin32
1 gem installed
Installing ri documentation for SystemTimer-1.1.1-x86-mswin32...
Installing RDoc documentation for SystemTimer-1.1.1-x86-mswin32...

However:

S:\system-timer>irb
irb(main):001:0> require 'systemtimer'
LoadError: no such file to load -- systemtimer
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from (irb):1

This seems to be because there is no systemtimer.rb present:

C:\ruby\lib\ruby\gems\1.8\gems\SystemTimer-1.1.1-x86-mswin32\lib>dir
 Volume in drive C is Preload
 Volume Serial Number is A000-F000

 Directory of C:\ruby\lib\ruby\gems\1.8\gems\SystemTimer-1.1.1-x86-mswin32\lib

06/24/2009  12:11 PM              .
06/24/2009  12:11 PM              ..
06/24/2009  11:58 AM               314 system_timer_stub.rb
               1 File(s)            314 bytes
               2 Dir(s)  16,773,083,136 bytes free

Copying system_timer_stub.rb to systemtimer.rb does work, but is obviously a hack.

ghazel commented 13 years ago

I made a fork which fixes some of this:

https://github.com/ghazel/system-timer

It's possible to rake package and then install the resulting gem, and it works.