Installation fails under Windows #34

Closed
jarmo opened this Issue Sep 24, 2012 · 41 comments

Comments

Projects
None yet
3 participants
@jarmo
Contributor

jarmo commented Sep 24, 2012

Trying to install under Windows (ruby 1.9.3p231), but failing:

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

        C:/tcs-ruby193_require_fenix_gc_hash_20120527/bin/ruby.exe extconf.rb
>>>>> Creating Makefile for tcs-ruby version 1.9.3 <<<<<
creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
<command-line>:0:4: warning: missing whitespace after the macro name
cache.c: In function 'oj_cache_new':
cache.c:54:5: warning: implicit declaration of function 'bzero'
cache.c:54:5: warning: incompatible implicit declaration of built-in function 'bzero'
compiling cache8.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling dump.c
<command-line>:0:4: warning: missing whitespace after the macro name
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/defines.h:223:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/win32.h:282:12: error: conflicting types for 'gettimeofday'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:39:29: note: previous declaration of 'gettimeofday' was here
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struct timezone'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:26:8: note: originally defined here
In file included from dump.c:39:0:
oj.h:50:21: fatal error: pthread.h: No such file or directory
compilation terminated.
make: *** [dump.o] Error 1


Gem files will remain installed in C:/tcs-ruby193_require_fenix_gc_hash_20120527/lib/ruby/gems/1.9.1/gems/oj-1.3.4 for inspection.
Results logged to C:/tcs-ruby193_require_fenix_gc_hash_20120527/lib/ruby/gems/1.9.1/gems/oj-1.3.4/ext/oj/gem_make.out
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Sep 24, 2012

Owner

This is a known problem right now. I do not currently have a windows environment to develop in. Would you be interested in helping port Oj to Windows?

Owner

ohler55 commented Sep 24, 2012

This is a known problem right now. I do not currently have a windows environment to develop in. Would you be interested in helping port Oj to Windows?

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Sep 25, 2012

Contributor

I could help you with testing on windows box, but not much with developing in C. Sorry.

Contributor

jarmo commented Sep 25, 2012

I could help you with testing on windows box, but not much with developing in C. Sorry.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Sep 26, 2012

Owner

We might be able to work something out. I am out of the country right now. Let me see what I can do next week.

On Sep 26, 2012, at 1:33 AM, Jarmo Pertman notifications@github.com wrote:

I could help you with testing on windows box, but not much with developing in C. Sorry.


Reply to this email directly or view it on GitHub.

Owner

ohler55 commented Sep 26, 2012

We might be able to work something out. I am out of the country right now. Let me see what I can do next week.

On Sep 26, 2012, at 1:33 AM, Jarmo Pertman notifications@github.com wrote:

I could help you with testing on windows box, but not much with developing in C. Sorry.


Reply to this email directly or view it on GitHub.

@ssnake

This comment has been minimized.

Show comment Hide comment
@ssnake

ssnake Oct 14, 2012

Are there any workarrounds so for? anyway +1 for win version

ssnake commented Oct 14, 2012

Are there any workarrounds so for? anyway +1 for win version

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

Anyone willing to help on the port? Being able to test would be a big help. Knowing something about the Windows development environment would be even better. Any takers?

Owner

ohler55 commented Oct 15, 2012

Anyone willing to help on the port? Being able to test would be a big help. Knowing something about the Windows development environment would be even better. Any takers?

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

I can help you out with testing as mentioned above. Not so much with writing C code although.

Contributor

jarmo commented Oct 15, 2012

I can help you out with testing as mentioned above. Not so much with writing C code although.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

Great, the first step is detecting a Windows install. I have modified the extconf.rb file. Please pull the latest source from github and do a gem install from inside the oj directory the email me the output.

If you can check the windows devkit for bzero() that would help too. See which header it is included in.

Thanks

Owner

ohler55 commented Oct 15, 2012

Great, the first step is detecting a Windows install. I have modified the extconf.rb file. Please pull the latest source from github and do a gem install from inside the oj directory the email me the output.

If you can check the windows devkit for bzero() that would help too. See which header it is included in.

Thanks

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor
C:\Users\jarmo\Documents\Projects\Ruby\oj>gem install oj-1.4.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oj-1.4.0.gem:
        ERROR: Failed to build gem native extension.

        C:/tcs-ruby193_require_fenix_gc_hash_20120527/bin/ruby.exe extconf.rb
>>>>> Creating Makefile for tcs-ruby version 1.9.3 on 012-05-27 <<<<<
creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
<command-line>:0:4: warning: missing whitespace after the macro name
cache.c: In function 'oj_cache_new':
cache.c:54:5: warning: implicit declaration of function 'bzero'
cache.c:54:5: warning: incompatible implicit declaration of built-in function 'bzero'
compiling cache8.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling dump.c
<command-line>:0:4: warning: missing whitespace after the macro name
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/defines.h:223:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/win32.h:282:12: error: conflicting types for 'gettimeofday'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:39:29: note: previous declaration of 'gettimeofday' was
 here
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struct timezone'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:26:8: note: originally defined here
In file included from dump.c:39:0:
oj.h:50:21: fatal error: pthread.h: No such file or directory
compilation terminated.
make: *** [dump.o] Error 1

For checking the headers, you can download DevKit from https://github.com/oneclick/rubyinstaller/downloads/, but it seems to be that bzero is defined in ssp/string.h:

#ifndef _SSP_STRING_H
...
#if __SSP_FORTIFY_LEVEL > 0
...
#undef bzero
...
#define bzero(dest, len) ((void) \
  ((__ssp_bos0 (dest) != (size_t) -1)                   \
   ? __builtin___memset_chk (dest, '\0', len, __ssp_bos0 (dest))    \
   : __memset_ichk (dest, '\0', len)))
...
#endif /* __SSP_FORTIFY_LEVEL > 0 */
#endif /* _SSP_STRING_H */
Contributor

jarmo commented Oct 15, 2012

C:\Users\jarmo\Documents\Projects\Ruby\oj>gem install oj-1.4.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oj-1.4.0.gem:
        ERROR: Failed to build gem native extension.

        C:/tcs-ruby193_require_fenix_gc_hash_20120527/bin/ruby.exe extconf.rb
>>>>> Creating Makefile for tcs-ruby version 1.9.3 on 012-05-27 <<<<<
creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
<command-line>:0:4: warning: missing whitespace after the macro name
cache.c: In function 'oj_cache_new':
cache.c:54:5: warning: implicit declaration of function 'bzero'
cache.c:54:5: warning: incompatible implicit declaration of built-in function 'bzero'
compiling cache8.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling dump.c
<command-line>:0:4: warning: missing whitespace after the macro name
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/defines.h:223:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/win32.h:282:12: error: conflicting types for 'gettimeofday'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:39:29: note: previous declaration of 'gettimeofday' was
 here
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struct timezone'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:26:8: note: originally defined here
In file included from dump.c:39:0:
oj.h:50:21: fatal error: pthread.h: No such file or directory
compilation terminated.
make: *** [dump.o] Error 1

For checking the headers, you can download DevKit from https://github.com/oneclick/rubyinstaller/downloads/, but it seems to be that bzero is defined in ssp/string.h:

#ifndef _SSP_STRING_H
...
#if __SSP_FORTIFY_LEVEL > 0
...
#undef bzero
...
#define bzero(dest, len) ((void) \
  ((__ssp_bos0 (dest) != (size_t) -1)                   \
   ? __builtin___memset_chk (dest, '\0', len, __ssp_bos0 (dest))    \
   : __memset_ichk (dest, '\0', len)))
...
#endif /* __SSP_FORTIFY_LEVEL > 0 */
#endif /* _SSP_STRING_H */
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

Thanks. tcs-ruby must use a different format for the description. I modified the extconf.rb again and also replaced bzero() with memset(). Can you repeat the previous steps, pull and install?

Owner

ohler55 commented Oct 15, 2012

Thanks. tcs-ruby must use a different format for the description. I modified the extconf.rb again and also replaced bzero() with memset(). Can you repeat the previous steps, pull and install?

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

Does not seem to be much of a difference. I can however try with RubyInstaller Ruby if you think that tcs build might cause any differences. By the way, check if my installation line is correct too, maybe you expect me to install it somehow differenctly:

C:\Users\jarmo\Documents\Projects\Ruby\oj>git pull && gem build oj.gemspec && gem install oj-1.4.0.gem --local
Updating e2979c6..cfd5e62
Fast-forward
 ext/oj/cache.c    |    3 ++-
 ext/oj/extconf.rb |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)
  Successfully built RubyGem
  Name: oj
  Version: 1.4.0
  File: oj-1.4.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oj-1.4.0.gem:
        ERROR: Failed to build gem native extension.

        C:/tcs-ruby193_require_fenix_gc_hash_20120527/bin/ruby.exe extconf.rb
>>>>> RUBY_DESCRIPTION: tcs-ruby 1.9.3p231 (2012-05-25, TCS patched 2012-05-27) [i386-mingw32] <<<<<<
>>>>> Creating Makefile for tcs-ruby version 1.9.3 on 012-05-27 <<<<<
creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling cache8.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling dump.c
<command-line>:0:4: warning: missing whitespace after the macro name
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/defines.h:223:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/win32.h:282:12: error: conflicting types for 'gettimeofday'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:39:29: note: previous declaration of 'gettimeofday' was
 here
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struct timezone'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:26:8: note: originally defined here
In file included from dump.c:39:0:
oj.h:50:21: fatal error: pthread.h: No such file or directory
compilation terminated.
make: *** [dump.o] Error 1


Gem files will remain installed in C:/tcs-ruby193_require_fenix_gc_hash_20120527/lib/ruby/gems/1.9.1/gems/oj-1.4.0 for inspection.
Results logged to C:/tcs-ruby193_require_fenix_gc_hash_20120527/lib/ruby/gems/1.9.1/gems/oj-1.4.0/ext/oj/gem_make.out
Contributor

jarmo commented Oct 15, 2012

Does not seem to be much of a difference. I can however try with RubyInstaller Ruby if you think that tcs build might cause any differences. By the way, check if my installation line is correct too, maybe you expect me to install it somehow differenctly:

C:\Users\jarmo\Documents\Projects\Ruby\oj>git pull && gem build oj.gemspec && gem install oj-1.4.0.gem --local
Updating e2979c6..cfd5e62
Fast-forward
 ext/oj/cache.c    |    3 ++-
 ext/oj/extconf.rb |    1 +
 2 files changed, 3 insertions(+), 1 deletions(-)
  Successfully built RubyGem
  Name: oj
  Version: 1.4.0
  File: oj-1.4.0.gem
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oj-1.4.0.gem:
        ERROR: Failed to build gem native extension.

        C:/tcs-ruby193_require_fenix_gc_hash_20120527/bin/ruby.exe extconf.rb
>>>>> RUBY_DESCRIPTION: tcs-ruby 1.9.3p231 (2012-05-25, TCS patched 2012-05-27) [i386-mingw32] <<<<<<
>>>>> Creating Makefile for tcs-ruby version 1.9.3 on 012-05-27 <<<<<
creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling cache8.c
<command-line>:0:4: warning: missing whitespace after the macro name
compiling dump.c
<command-line>:0:4: warning: missing whitespace after the macro name
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/defines.h:223:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:67,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/win32.h:282:12: error: conflicting types for 'gettimeofday'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:39:29: note: previous declaration of 'gettimeofday' was
 here
In file included from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/ruby.h:1381:0,
                 from c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby.h:32,
                 from oj.h:43,
                 from dump.c:39:
c:/tcs-ruby193_require_fenix_gc_hash_20120527/include/ruby-1.9.1/ruby/missing.h:48:8: error: redefinition of 'struct timezone'
c:\bin\devkit\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/sys/time.h:26:8: note: originally defined here
In file included from dump.c:39:0:
oj.h:50:21: fatal error: pthread.h: No such file or directory
compilation terminated.
make: *** [dump.o] Error 1


Gem files will remain installed in C:/tcs-ruby193_require_fenix_gc_hash_20120527/lib/ruby/gems/1.9.1/gems/oj-1.4.0 for inspection.
Results logged to C:/tcs-ruby193_require_fenix_gc_hash_20120527/lib/ruby/gems/1.9.1/gems/oj-1.4.0/ext/oj/gem_make.out
@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

Looking at the headers in error message, i can see this:

// sys/time.h:39
int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__,
             void *__restrict__  /* tzp (unused) */);

// win32.h:282
extern int gettimeofday(struct timeval *, struct timezone *);

I'm not sure what to think of that but they seem to be rather different.

Contributor

jarmo commented Oct 15, 2012

Looking at the headers in error message, i can see this:

// sys/time.h:39
int __cdecl __MINGW_NOTHROW gettimeofday(struct timeval *__restrict__,
             void *__restrict__  /* tzp (unused) */);

// win32.h:282
extern int gettimeofday(struct timeval *, struct timezone *);

I'm not sure what to think of that but they seem to be rather different.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

I'm seeing same error messages with RubyInstaller Ruby 1.9.3p194 so tcs is not behaving differently.

Contributor

jarmo commented Oct 15, 2012

I'm seeing same error messages with RubyInstaller Ruby 1.9.3p194 so tcs is not behaving differently.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

I googled for similar problems and found that stack_tracy had a similar problem, which got solved by removing include line to sys/time.h. Unfortunately oj.h does not include that line so can't try if that would help.

Original issue is located here:
archan937/stack_tracy#1

Contributor

jarmo commented Oct 15, 2012

I googled for similar problems and found that stack_tracy had a similar problem, which got solved by removing include line to sys/time.h. Unfortunately oj.h does not include that line so can't try if that would help.

Original issue is located here:
archan937/stack_tracy#1

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

The oddness is the patch level between the (). I need to be smarter about the description parsing or else use RUBY_PLATFORM instead.

It does look like the bzero replacement with memset worked. This is actually very helpful. My next steps will be to exclude the system #includes and rely on the devkit versions of gettimeofday and timezone.

I will let you know when that is ready.

Owner

ohler55 commented Oct 15, 2012

The oddness is the patch level between the (). I need to be smarter about the description parsing or else use RUBY_PLATFORM instead.

It does look like the bzero replacement with memset worked. This is actually very helpful. My next steps will be to exclude the system #includes and rely on the devkit versions of gettimeofday and timezone.

I will let you know when that is ready.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

I just noticed that i had done some mistake when trying to install with RubyInstaller Ruby, since now i'm seeing a different error:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oj-1.4.0.gem:
        ERROR: Failed to build gem native extension.

        C:/bin/Ruby193/bin/ruby.exe extconf.rb --with-ruby-include=c:\ruby-1.9.3-p194-src
*** 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:/bin/Ruby193/bin/ruby
        --with-oj-dir
        --without-oj-dir
        --with-oj-include
        --without-oj-include=${oj-dir}/include
        --with-oj-lib
        --without-oj-lib=${oj-dir}/lib
extconf.rb:9:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)


Gem files will remain installed in C:/bin/Ruby193/lib/ruby/gems/1.9.1/gems/oj-1.4.0 for inspection.
Results logged to C:/bin/Ruby193/lib/ruby/gems/1.9.1/gems/oj-1.4.0/ext/oj/gem_make.out

When changing extconf.rb lines 8 and 9 to this:

puts ">>>>> RUBY_DESCRIPTION: #{RUBY_DESCRIPTION} <<<<<<"
puts parts.inspect

Then i can see output like this:

>>>>> RUBY_DESCRIPTION: ruby 1.9.3p194 (2012-04-20) [i386-mingw32] <<<<<<
["ruby", "1.9.3p194", "(2012-04-20)", "[i386-mingw32]"]

What do you want to accomplish with RUBY_DESCRIPTION actually? Do you want to detect if it is Windows? That is usually detected in gems like this:

RUBY_PLATFORM =~ /mswin|msys|mingw/
Contributor

jarmo commented Oct 15, 2012

I just noticed that i had done some mistake when trying to install with RubyInstaller Ruby, since now i'm seeing a different error:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing oj-1.4.0.gem:
        ERROR: Failed to build gem native extension.

        C:/bin/Ruby193/bin/ruby.exe extconf.rb --with-ruby-include=c:\ruby-1.9.3-p194-src
*** 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:/bin/Ruby193/bin/ruby
        --with-oj-dir
        --without-oj-dir
        --with-oj-include
        --without-oj-include=${oj-dir}/include
        --with-oj-lib
        --without-oj-lib=${oj-dir}/lib
extconf.rb:9:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)


Gem files will remain installed in C:/bin/Ruby193/lib/ruby/gems/1.9.1/gems/oj-1.4.0 for inspection.
Results logged to C:/bin/Ruby193/lib/ruby/gems/1.9.1/gems/oj-1.4.0/ext/oj/gem_make.out

When changing extconf.rb lines 8 and 9 to this:

puts ">>>>> RUBY_DESCRIPTION: #{RUBY_DESCRIPTION} <<<<<<"
puts parts.inspect

Then i can see output like this:

>>>>> RUBY_DESCRIPTION: ruby 1.9.3p194 (2012-04-20) [i386-mingw32] <<<<<<
["ruby", "1.9.3p194", "(2012-04-20)", "[i386-mingw32]"]

What do you want to accomplish with RUBY_DESCRIPTION actually? Do you want to detect if it is Windows? That is usually detected in gems like this:

RUBY_PLATFORM =~ /mswin|msys|mingw/
@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

When i revert to the commit before Windows porting commits i'm seeing the same error as with tcs build.

Contributor

jarmo commented Oct 15, 2012

When i revert to the commit before Windows porting commits i'm seeing the same error as with tcs build.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

I have made some new changes. I think this will help. Please pull and try again.
You have been feeding me good info. Thanks.

Owner

ohler55 commented Oct 15, 2012

I have made some new changes. I think this will help. Please pull and try again.
You have been feeding me good info. Thanks.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

Not yet, but making progress

creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c:31:26: fatal error: sys/resource.h: No such file or directory
compilation terminated.
make: *** [fast.o] Error 1
Contributor

jarmo commented Oct 15, 2012

Not yet, but making progress

creating Makefile

make
generating oj-i386-mingw32.def
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c:31:26: fatal error: sys/resource.h: No such file or directory
compilation terminated.
make: *** [fast.o] Error 1
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

Okay, how about now. I commented out the sys/resource.h include. Lets see if the compile complains about getrlimit().

Owner

ohler55 commented Oct 15, 2012

Okay, how about now. I commented out the sys/resource.h include. Lets see if the compile complains about getrlimit().

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor

Yup, you were correct:

make
generating oj-i386-mingw32.def
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c: In function 'read_next':
fast.c:482:9: warning: cast from pointer to integer of different size
fast.c: In function 'parse_json':
fast.c:835:19: error: storage size of 'lim' isn't known
fast.c:846:5: warning: implicit declaration of function 'getrlimit'
fast.c:846:24: error: 'RLIMIT_STACK' undeclared (first use in this function)
fast.c:846:24: note: each undeclared identifier is reported only once for each function it appears in
fast.c:835:19: warning: unused variable 'lim'
fast.c: In function 'doc_where':
fast.c:1230:3: warning: implicit declaration of function 'stpcpy'
fast.c:1230:7: warning: incompatible implicit declaration of built-in function 'stpcpy'
make: *** [fast.o] Error 1
Contributor

jarmo commented Oct 15, 2012

Yup, you were correct:

make
generating oj-i386-mingw32.def
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c: In function 'read_next':
fast.c:482:9: warning: cast from pointer to integer of different size
fast.c: In function 'parse_json':
fast.c:835:19: error: storage size of 'lim' isn't known
fast.c:846:5: warning: implicit declaration of function 'getrlimit'
fast.c:846:24: error: 'RLIMIT_STACK' undeclared (first use in this function)
fast.c:846:24: note: each undeclared identifier is reported only once for each function it appears in
fast.c:835:19: warning: unused variable 'lim'
fast.c: In function 'doc_where':
fast.c:1230:3: warning: implicit declaration of function 'stpcpy'
fast.c:1230:7: warning: incompatible implicit declaration of built-in function 'stpcpy'
make: *** [fast.o] Error 1
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

Ready for another shot.

Owner

ohler55 commented Oct 15, 2012

Ready for another shot.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 15, 2012

Contributor
make
generating oj-i386-mingw32.def
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c: In function 'read_next':
fast.c:484:9: warning: cast from pointer to integer of different size
fast.c: In function 'parse_json':
fast.c:849:17: warning: cast from pointer to integer of different size
fast.c:856:4: error: 'else' without a previous 'if'
fast.c:836:11: warning: unused variable 'ex'
fast.c:834:12: warning: unused variable 'result'
fast.c:859:5: warning: no return statement in function returning non-void
fast.c: At top level:
fast.c:861:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
fast.c:862:28: error: expected declaration specifiers or '...' before '&' token
fast.c:862:5: warning: data definition has no type or storage class
fast.c:862:5: warning: type defaults to 'int' in declaration of 'rb_gc_register_address'
fast.c:862:5: error: conflicting types for 'rb_gc_register_address'
c:/bin/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1110:6: note: previous declaration of 'rb_gc_register_address' was here
fast.c:863:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
fast.c:864:5: error: expected identifier or '(' before 'struct'
fast.c:864:5: error: expected ')' before '(' token
fast.c:864:5: error: expected ')' before '->' token
fast.c:865:5: warning: data definition has no type or storage class
fast.c:865:5: warning: type defaults to 'int' in declaration of 'result'
fast.c:865:52: error: 'pi' undeclared here (not in a function)
fast.c:865:57: error: 'ex' undeclared here (not in a function)
fast.c:866:5: error: expected identifier or '(' before 'if'
fast.c:873:7: error: expected identifier or '(' before 'else'
fast.c:876:5: error: expected identifier or '(' before 'if'
fast.c:879:5: error: expected identifier or '(' before 'return'
fast.c:880:1: error: expected identifier or '(' before '}' token
fast.c:822:1: warning: 'free_doc_cb' defined but not used
make: *** [fast.o] Error 1
Contributor

jarmo commented Oct 15, 2012

make
generating oj-i386-mingw32.def
compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c: In function 'read_next':
fast.c:484:9: warning: cast from pointer to integer of different size
fast.c: In function 'parse_json':
fast.c:849:17: warning: cast from pointer to integer of different size
fast.c:856:4: error: 'else' without a previous 'if'
fast.c:836:11: warning: unused variable 'ex'
fast.c:834:12: warning: unused variable 'result'
fast.c:859:5: warning: no return statement in function returning non-void
fast.c: At top level:
fast.c:861:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
fast.c:862:28: error: expected declaration specifiers or '...' before '&' token
fast.c:862:5: warning: data definition has no type or storage class
fast.c:862:5: warning: type defaults to 'int' in declaration of 'rb_gc_register_address'
fast.c:862:5: error: conflicting types for 'rb_gc_register_address'
c:/bin/Ruby193/include/ruby-1.9.1/ruby/ruby.h:1110:6: note: previous declaration of 'rb_gc_register_address' was here
fast.c:863:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
fast.c:864:5: error: expected identifier or '(' before 'struct'
fast.c:864:5: error: expected ')' before '(' token
fast.c:864:5: error: expected ')' before '->' token
fast.c:865:5: warning: data definition has no type or storage class
fast.c:865:5: warning: type defaults to 'int' in declaration of 'result'
fast.c:865:52: error: 'pi' undeclared here (not in a function)
fast.c:865:57: error: 'ex' undeclared here (not in a function)
fast.c:866:5: error: expected identifier or '(' before 'if'
fast.c:873:7: error: expected identifier or '(' before 'else'
fast.c:876:5: error: expected identifier or '(' before 'if'
fast.c:879:5: error: expected identifier or '(' before 'return'
fast.c:880:1: error: expected identifier or '(' before '}' token
fast.c:822:1: warning: 'free_doc_cb' defined but not used
make: *** [fast.o] Error 1
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 15, 2012

Owner

Another attempt. I will be away for a couple of hours after this but will pick it up again tonight.

Owner

ohler55 commented Oct 15, 2012

Another attempt. I will be away for a couple of hours after this but will pick it up again tonight.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

Have you been able to run with the latest?

Owner

ohler55 commented Oct 16, 2012

Have you been able to run with the latest?

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

Sorry, it was night time here where i'm living so i was sleeping :)

Here are the latest results:

compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c: In function 'read_next':
fast.c:484:9: warning: cast from pointer to integer of different size
fast.c: In function 'parse_json':
fast.c:848:20: warning: cast from pointer to integer of different size
compiling load.c
load.c: In function 'read_next':
load.c:326:9: warning: cast from pointer to integer of different size
load.c: In function 'oj_parse':
load.c:1021:20: warning: cast from pointer to integer of different size
compiling oj.c
oj.c:37:21: fatal error: sys/uio.h: No such file or directory
compilation terminated.
make: *** [oj.o] Error 1
Contributor

jarmo commented Oct 16, 2012

Sorry, it was night time here where i'm living so i was sleeping :)

Here are the latest results:

compiling cache.c
compiling cache8.c
compiling dump.c
compiling fast.c
fast.c: In function 'read_next':
fast.c:484:9: warning: cast from pointer to integer of different size
fast.c: In function 'parse_json':
fast.c:848:20: warning: cast from pointer to integer of different size
compiling load.c
load.c: In function 'read_next':
load.c:326:9: warning: cast from pointer to integer of different size
load.c: In function 'oj_parse':
load.c:1021:20: warning: cast from pointer to integer of different size
compiling oj.c
oj.c:37:21: fatal error: sys/uio.h: No such file or directory
compilation terminated.
make: *** [oj.o] Error 1
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

Give it another shot. I recently moved from Japan to the US so I understand the time differences.

Owner

ohler55 commented Oct 16, 2012

Give it another shot. I recently moved from Japan to the US so I understand the time differences.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

Sorry when i sounded rude about time zone differences. I wanted to be anything, but rude with that statement.

But good news!

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed oj-1.4.0
1 gem installed

And here are the test results with only one failure:

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby tests.rb
Run options:

# Running tests:

...........................................E.........................................

Finished tests in 0.015000s, 5666.6667 tests/s, 8600.0000 assertions/s.

  1) Error:
test_io_file(Juice):
IOError: failed to read from IO Object.
    tests.rb:825:in `load'
    tests.rb:825:in `test_io_file'

85 tests, 129 assertions, 0 failures, 1 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_mimic.rb
Run options:

# Running tests:

.................

Finished tests in 0.006000s, 2833.3333 tests/s, 3833.3333 assertions/s.

17 tests, 23 assertions, 0 failures, 0 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_fast.rb
Run options:

# Running tests:

.................................

Finished tests in 0.015001s, 2199.8533 tests/s, 6999.5334 assertions/s.

33 tests, 105 assertions, 0 failures, 0 errors, 0 skips

I'm getting a little different results when using Ruby's tcs build although;

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby tests.rb
Run options:

# Running tests:

.....................................F.....E................EEE......................

Finished tests in 0.027001s, 3148.0316 tests/s, 4444.2798 assertions/s.

  1) Failure:
test_encode(Juice) [tests.rb:882]:
<"\u3074\u30FC\u305F\u30FC"> expected but was
<"\xE3\x81\xB4\xE3\x83\xBC\xE3\x81\x9F\xE3\x83\xBC">.

  2) Error:
test_io_file(Juice):
IOError: failed to read from IO Object.
    tests.rb:825:in `load'
    tests.rb:825:in `test_io_file'

  3) Error:
test_range_compat(Juice):
NotImplementedError: Failed to dump 'Range' Object (09)

    tests.rb:609:in `dump'
    tests.rb:609:in `test_range_compat'

  4) Error:
test_range_null(Juice):
NotImplementedError: Failed to dump 'Range' Object (09)

    tests.rb:605:in `dump'
    tests.rb:605:in `test_range_null'

  5) Error:
test_range_object(Juice):
NotImplementedError: Failed to dump 'Range' Object (09)

    tests.rb:619:in `dump'
    tests.rb:619:in `test_range_object'

85 tests, 120 assertions, 1 failures, 4 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_mimic.rb
Run options:

# Running tests:

.........E.......

Finished tests in 0.003001s, 5664.7784 tests/s, 6997.6674 assertions/s.

  1) Error:
test_load_proc(Mimic):
NotImplementedError: Calling a Proc with a block not supported in this version. Use func() {|x| } syntax instead.
    test_mimic.rb:79:in `load'
    test_mimic.rb:79:in `test_load_proc'

17 tests, 21 assertions, 0 failures, 1 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_fast.rb
Run options:

# Running tests:

.................................

Finished tests in 0.009001s, 3666.2593 tests/s, 11665.3705 assertions/s.

33 tests, 105 assertions, 0 failures, 0 errors, 0 skips

Thanks for your good job!

Contributor

jarmo commented Oct 16, 2012

Sorry when i sounded rude about time zone differences. I wanted to be anything, but rude with that statement.

But good news!

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed oj-1.4.0
1 gem installed

And here are the test results with only one failure:

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby tests.rb
Run options:

# Running tests:

...........................................E.........................................

Finished tests in 0.015000s, 5666.6667 tests/s, 8600.0000 assertions/s.

  1) Error:
test_io_file(Juice):
IOError: failed to read from IO Object.
    tests.rb:825:in `load'
    tests.rb:825:in `test_io_file'

85 tests, 129 assertions, 0 failures, 1 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_mimic.rb
Run options:

# Running tests:

.................

Finished tests in 0.006000s, 2833.3333 tests/s, 3833.3333 assertions/s.

17 tests, 23 assertions, 0 failures, 0 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_fast.rb
Run options:

# Running tests:

.................................

Finished tests in 0.015001s, 2199.8533 tests/s, 6999.5334 assertions/s.

33 tests, 105 assertions, 0 failures, 0 errors, 0 skips

I'm getting a little different results when using Ruby's tcs build although;

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby tests.rb
Run options:

# Running tests:

.....................................F.....E................EEE......................

Finished tests in 0.027001s, 3148.0316 tests/s, 4444.2798 assertions/s.

  1) Failure:
test_encode(Juice) [tests.rb:882]:
<"\u3074\u30FC\u305F\u30FC"> expected but was
<"\xE3\x81\xB4\xE3\x83\xBC\xE3\x81\x9F\xE3\x83\xBC">.

  2) Error:
test_io_file(Juice):
IOError: failed to read from IO Object.
    tests.rb:825:in `load'
    tests.rb:825:in `test_io_file'

  3) Error:
test_range_compat(Juice):
NotImplementedError: Failed to dump 'Range' Object (09)

    tests.rb:609:in `dump'
    tests.rb:609:in `test_range_compat'

  4) Error:
test_range_null(Juice):
NotImplementedError: Failed to dump 'Range' Object (09)

    tests.rb:605:in `dump'
    tests.rb:605:in `test_range_null'

  5) Error:
test_range_object(Juice):
NotImplementedError: Failed to dump 'Range' Object (09)

    tests.rb:619:in `dump'
    tests.rb:619:in `test_range_object'

85 tests, 120 assertions, 1 failures, 4 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_mimic.rb
Run options:

# Running tests:

.........E.......

Finished tests in 0.003001s, 5664.7784 tests/s, 6997.6674 assertions/s.

  1) Error:
test_load_proc(Mimic):
NotImplementedError: Calling a Proc with a block not supported in this version. Use func() {|x| } syntax instead.
    test_mimic.rb:79:in `load'
    test_mimic.rb:79:in `test_load_proc'

17 tests, 21 assertions, 0 failures, 1 errors, 0 skips

C:\Users\jarmo\Documents\Projects\Ruby\oj\test>ruby test_fast.rb
Run options:

# Running tests:

.................................

Finished tests in 0.009001s, 3666.2593 tests/s, 11665.3705 assertions/s.

33 tests, 105 assertions, 0 failures, 0 errors, 0 skips

Thanks for your good job!

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

Thanks for the help getting Oj to compile. Would you mind continuing to get the functionality working. No offense taken at all on the timezone.

So there are two Windows Rubies I gather. What are they referred to as? tis-ruby and what is the other?

The Range handling is most likely due to a different implementation of the Range class. That will take a few iterations and some debug statements but I'm sure we can get it working.

The file IO is a tougher one without being on a Windows machine. Can you take a look at the failing test and try doing the same thing in irb or your own test program and see where or if the file is written. Then try reading the file and see if that goes okay. After that see if you can perform IO operations on the file.

It is my turn to get some sleep but I will look at this again tomorrow. A set of IO tests may be needed.

Owner

ohler55 commented Oct 16, 2012

Thanks for the help getting Oj to compile. Would you mind continuing to get the functionality working. No offense taken at all on the timezone.

So there are two Windows Rubies I gather. What are they referred to as? tis-ruby and what is the other?

The Range handling is most likely due to a different implementation of the Range class. That will take a few iterations and some debug statements but I'm sure we can get it working.

The file IO is a tougher one without being on a Windows machine. Can you take a look at the failing test and try doing the same thing in irb or your own test program and see where or if the file is written. Then try reading the file and see if that goes okay. After that see if you can perform IO operations on the file.

It is my turn to get some sleep but I will look at this again tomorrow. A set of IO tests may be needed.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

RubyInstaller Ruby is the "official" on Windows. Tcs is the TheCodeShop experimental Ruby, where improvements to Ruby on Windows are done before changes are merged into Ruby's trunk, so it might have its own problems (haven't seen any so far though before this). I can ask from tcs community about these problems.

IO problem is something strange though. The file is written correctly and i can make that test pass if changing the code like this:

f = File.new(filename)
f.read
obj = Oj.load(f, :mode => :strict)

As soon as i remove the f.read line then the failure comes back. f.read also returns correct file contents.

Contributor

jarmo commented Oct 16, 2012

RubyInstaller Ruby is the "official" on Windows. Tcs is the TheCodeShop experimental Ruby, where improvements to Ruby on Windows are done before changes are merged into Ruby's trunk, so it might have its own problems (haven't seen any so far though before this). I can ask from tcs community about these problems.

IO problem is something strange though. The file is written correctly and i can make that test pass if changing the code like this:

f = File.new(filename)
f.read
obj = Oj.load(f, :mode => :strict)

As soon as i remove the f.read line then the failure comes back. f.read also returns correct file contents.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

In oj.c:400 the following line fails:

if (0 >= (cnt = read(fd, json, len)) || cnt != (ssize_t)len) {

The reason is that at least on Windows, cnt=41 and len=46. One suspicion i have is that len takes CR LF into account, but cnt takes only LF. There is exactly 5 CR symbols in that file and len - cnt == 5.

Contributor

jarmo commented Oct 16, 2012

In oj.c:400 the following line fails:

if (0 >= (cnt = read(fd, json, len)) || cnt != (ssize_t)len) {

The reason is that at least on Windows, cnt=41 and len=46. One suspicion i have is that len takes CR LF into account, but cnt takes only LF. There is exactly 5 CR symbols in that file and len - cnt == 5.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

Returning a different length than whats actually in the file is really broken. Let me chew on that. In the mean time, can you try this test? Just adding the f.read should not make a difference unless Ruby is not closing the file. I broke the open into separate steps assuming Ruby is not working correctly.

def test_io_file
filename = 'open_file_test.json'
f = File.open(filename, 'w')
f.write(%{{
"x":true,
"y":58,
"z": [1,2,3]
}
})
f.close()
f = File.new(filename)
obj = Oj.load(f, :mode => :strict)
f.close()
assert_equal({ 'x' => true, 'y' => 58, 'z' => [1, 2, 3]}, obj)
end

Owner

ohler55 commented Oct 16, 2012

Returning a different length than whats actually in the file is really broken. Let me chew on that. In the mean time, can you try this test? Just adding the f.read should not make a difference unless Ruby is not closing the file. I broke the open into separate steps assuming Ruby is not working correctly.

def test_io_file
filename = 'open_file_test.json'
f = File.open(filename, 'w')
f.write(%{{
"x":true,
"y":58,
"z": [1,2,3]
}
})
f.close()
f = File.new(filename)
obj = Oj.load(f, :mode => :strict)
f.close()
assert_equal({ 'x' => true, 'y' => 58, 'z' => [1, 2, 3]}, obj)
end

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

I've just sent you a pull request with changes which fixed the problem for me. In other words - it seems to me that JRuby and Ruby on Windows behave the same. Let me know if you find that solution to be bad.

Contributor

jarmo commented Oct 16, 2012

I've just sent you a pull request with changes which fixed the problem for me. In other words - it seems to me that JRuby and Ruby on Windows behave the same. Let me know if you find that solution to be bad.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

Changing test like you proposed above does not fix the problem if i revert my changes made with pull request.

Contributor

jarmo commented Oct 16, 2012

Changing test like you proposed above does not fix the problem if i revert my changes made with pull request.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

I thought you were not C programer. You made a good fix to the C code.

Owner

ohler55 commented Oct 16, 2012

I thought you were not C programer. You made a good fix to the C code.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

As i said, i'm not a C programmer and can't help you much with C. This was a small fix/change :)

Regarding other failures on tcs ruby i've created a post in their google group: https://groups.google.com/forum/?fromgroups=#!topic/thecodeshop/a57dn683cgI

If you have anything to add, then feel free to do so!

Thank you for everything so far.

I guess this issue can be closed now since the original issue of gem not compiling is now fixed?

Contributor

jarmo commented Oct 16, 2012

As i said, i'm not a C programmer and can't help you much with C. This was a small fix/change :)

Regarding other failures on tcs ruby i've created a post in their google group: https://groups.google.com/forum/?fromgroups=#!topic/thecodeshop/a57dn683cgI

If you have anything to add, then feel free to do so!

Thank you for everything so far.

I guess this issue can be closed now since the original issue of gem not compiling is now fixed?

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

In regard to the range, what is the output for the RubyInstaller and for tcs-ruby? The check for RSTRUCT support needs to determine which supports that option. We can then adjust the test to match.

Owner

ohler55 commented Oct 16, 2012

In regard to the range, what is the output for the RubyInstaller and for tcs-ruby? The check for RSTRUCT support needs to determine which supports that option. We can then adjust the test to match.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

I don't want to close the issue until all the tests pass as well. If you are still game we can continue.

Owner

ohler55 commented Oct 16, 2012

I don't want to close the issue until all the tests pass as well. If you are still game we can continue.

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 16, 2012

Contributor

It seems to me that one of the problems with ranges is the check of type in extconf.rb when using RUBY_DESCRIPTION. type is tcs-ruby in that line. It seems to me that there should be a better way to check these things you're interested in instead of using RUBY_DESCRIPTION. Adding check for tcs-ruby for HAS_RSTRUCT made all Range tests to pass, but i'm getting one additional failure:

'HAS_RSTRUCT' => ('ruby' == type || 'ree' == type || 'tcs-ruby' == type) ? 1 : 0,

The failure is:

test_range_object(Juice):
ArgumentError: bad value for range
    test/tests.rb:882:in `initialize'
    test/tests.rb:882:in `load'
    test/tests.rb:882:in `dump_and_load'
    test/tests.rb:627:in `test_range_object'
Contributor

jarmo commented Oct 16, 2012

It seems to me that one of the problems with ranges is the check of type in extconf.rb when using RUBY_DESCRIPTION. type is tcs-ruby in that line. It seems to me that there should be a better way to check these things you're interested in instead of using RUBY_DESCRIPTION. Adding check for tcs-ruby for HAS_RSTRUCT made all Range tests to pass, but i'm getting one additional failure:

'HAS_RSTRUCT' => ('ruby' == type || 'ree' == type || 'tcs-ruby' == type) ? 1 : 0,

The failure is:

test_range_object(Juice):
ArgumentError: bad value for range
    test/tests.rb:882:in `initialize'
    test/tests.rb:882:in `load'
    test/tests.rb:882:in `dump_and_load'
    test/tests.rb:627:in `test_range_object'
@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 16, 2012

Owner

Go ahead and put in a merge request for the extconf.rb file.

On the range test that is still failing, set the second argument to dump_and_load() to true. That will print out the JSON so you can check it. Also try irb with a range of (1..1) and see if it complains.

Owner

ohler55 commented Oct 16, 2012

Go ahead and put in a merge request for the extconf.rb file.

On the range test that is still failing, set the second argument to dump_and_load() to true. That will print out the JSON so you can check it. Also try irb with a range of (1..1) and see if it complains.

@ohler55

This comment has been minimized.

Show comment Hide comment
@ohler55

ohler55 Oct 17, 2012

Owner

Oj 1.4.1 now has support for Windows. Thanks Jarmo.

Owner

ohler55 commented Oct 17, 2012

Oj 1.4.1 now has support for Windows. Thanks Jarmo.

@ohler55 ohler55 closed this Oct 17, 2012

@jarmo

This comment has been minimized.

Show comment Hide comment
@jarmo

jarmo Oct 18, 2012

Contributor

Thank you for your awesome work :)

Contributor

jarmo commented Oct 18, 2012

Thank you for your awesome work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment