clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* gem fails to build on Win 7 32 bit, DevKit 3.7.2 (rubyinstaller.org)
@ 2016-07-25 15:07 Ben Armstrong
  2016-07-25 21:04 ` Eric Wong
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Armstrong @ 2016-07-25 15:07 UTC (permalink / raw)
  To: clogger-public

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

Hi,

I want to use clogger on Windows with the rubyinstaller.org version of 
Ruby 2.2.4. However, the native gem will not build. I have attached the 
gem_make.out from my failed attempt. Please resolve or let me know if 
there's anything else I can try to help solve this.

Thanks,

Ben

[-- Attachment #2: gem_make.out --]
[-- Type: text/plain, Size: 3061 bytes --]

current directory: c:/Ruby22/lib/ruby/gems/2.2.0/gems/clogger-2.0.2/ext/clogger_ext
c:/Ruby22/bin/ruby.exe -r ./siteconf20160725-8240-12azzw.rb extconf.rb
checking for ruby.h... yes
checking for fcntl.h... yes
checking for F_GETFL in fcntl.h... no
checking for O_NONBLOCK in unistd.h,fcntl.h... yes
checking for CLOCK_MONOTONIC in time.h... yes
checking for clockid_t in time.h... yes
checking for clock_gettime() in time.h... yes
checking for localtime_r() in time.h... yes
checking for gmtime_r() in time.h... yes
checking for struct tm.tm_gmtoff in time.h... no
checking for rb_str_set_len() in ruby.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region() in ruby.h... no
checking for rb_thread_io_blocking_region() in ruby.h... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  c:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/clogger-2.0.2/mkmf.log

current directory: c:/Ruby22/lib/ruby/gems/2.2.0/gems/clogger-2.0.2/ext/clogger_ext
make "DESTDIR=" clean

current directory: c:/Ruby22/lib/ruby/gems/2.2.0/gems/clogger-2.0.2/ext/clogger_ext
make "DESTDIR="
generating clogger_ext-i386-mingw32.def
compiling clogger.c
In file included from clogger.c:11:0:
c:\devkit4.7.2\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/sys/time.h:42:13: error: conflicting types for 'gettimeofday'
In file included from c:/Ruby22/include/ruby-2.2.0/ruby/defines.h:163:0,
                 from c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:29,
                 from c:/Ruby22/include/ruby-2.2.0/ruby.h:33,
                 from clogger.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:318:12: note: previous declaration of 'gettimeofday' was here
In file included from clogger.c:24:0:
blocking_helpers.h:57:0: warning: "stat" redefined [enabled by default]
In file included from c:/Ruby22/include/ruby-2.2.0/ruby/defines.h:163:0,
                 from c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:29,
                 from c:/Ruby22/include/ruby-2.2.0/ruby.h:33,
                 from clogger.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:199:0: note: this is the location of the previous definition
clogger.c: In function 'to_path':
clogger.c:994:3: warning: passing argument 2 of 'fstati64' from incompatible pointer type [enabled by default]
In file included from c:/Ruby22/include/ruby-2.2.0/ruby/defines.h:163:0,
                 from c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:29,
                 from c:/Ruby22/include/ruby-2.2.0/ruby.h:33,
                 from clogger.c:1:
c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:483:12: note: expected 'struct _stat64 *' but argument is of type 'struct stat *'
clogger.c:996:3: warning: passing argument 2 of 'my_stat' from incompatible pointer type [enabled by default]
In file included from clogger.c:24:0:
blocking_helpers.h:21:12: note: expected 'struct _stat64 *' but argument is of type 'struct stat *'
make: *** [clogger.o] Error 1

make failed, exit code 2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gem fails to build on Win 7 32 bit, DevKit 3.7.2 (rubyinstaller.org)
  2016-07-25 15:07 gem fails to build on Win 7 32 bit, DevKit 3.7.2 (rubyinstaller.org) Ben Armstrong
@ 2016-07-25 21:04 ` Eric Wong
  2016-07-26  9:35   ` Ben Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Wong @ 2016-07-25 21:04 UTC (permalink / raw)
  To: Ben Armstrong; +Cc: clogger-public

Ben Armstrong <BArmstrong@dymaxion.ca> wrote:
> Hi,
> 
> I want to use clogger on Windows with the rubyinstaller.org version of Ruby
> 2.2.4. However, the native gem will not build. I have attached the
> gem_make.out from my failed attempt. Please resolve or let me know if
> there's anything else I can try to help solve this.

Is the pure-Ruby version acceptable for you?

I wonder if extconf.rb should just bail out with

	if RUBY_PLATFORM =~ /win32/i
	  raise "C ext not supported on RUBY_PLATFORM=#{RUBY_PLATFORM}"
	end

if this can't be fixed...

More comments below...

> current directory: c:/Ruby22/lib/ruby/gems/2.2.0/gems/clogger-2.0.2/ext/clogger_ext
> c:/Ruby22/bin/ruby.exe -r ./siteconf20160725-8240-12azzw.rb extconf.rb
> checking for ruby.h... yes
> checking for fcntl.h... yes
> checking for F_GETFL in fcntl.h... no
> checking for O_NONBLOCK in unistd.h,fcntl.h... yes
> checking for CLOCK_MONOTONIC in time.h... yes
> checking for clockid_t in time.h... yes
> checking for clock_gettime() in time.h... yes

I guess ruby/win32.h defines clock_gettime...

> checking for localtime_r() in time.h... yes
> checking for gmtime_r() in time.h... yes
> checking for struct tm.tm_gmtoff in time.h... no
> checking for rb_str_set_len() in ruby.h... yes
> checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
> checking for rb_thread_blocking_region() in ruby.h... no
> checking for rb_thread_io_blocking_region() in ruby.h... yes
> creating Makefile

Can you share the generated Makefile and maybe mkmf.log, too?

I can't do much to fix this problem since I don't use non-Free
systems, but a non-intrusive patch would be acceptable
(even if it's just bailing on the C extension build to force
use of the pure Ruby version).

> To see why this extension failed to compile, please check the mkmf.log which can be found here:
> 
>   c:/Ruby22/lib/ruby/gems/2.2.0/extensions/x86-mingw32/2.2.0/clogger-2.0.2/mkmf.log
> 
> current directory: c:/Ruby22/lib/ruby/gems/2.2.0/gems/clogger-2.0.2/ext/clogger_ext
> make "DESTDIR=" clean
> 
> current directory: c:/Ruby22/lib/ruby/gems/2.2.0/gems/clogger-2.0.2/ext/clogger_ext
> make "DESTDIR="
> generating clogger_ext-i386-mingw32.def
> compiling clogger.c
> In file included from clogger.c:11:0:
> c:\devkit4.7.2\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/include/sys/time.h:42:13: error: conflicting types for 'gettimeofday'

Can you comment out sys/time.h?

> In file included from c:/Ruby22/include/ruby-2.2.0/ruby/defines.h:163:0,
>                  from c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:29,
>                  from c:/Ruby22/include/ruby-2.2.0/ruby.h:33,
>                  from clogger.c:1:
> c:/Ruby22/include/ruby-2.2.0/ruby/win32.h:318:12: note: previous declaration of 'gettimeofday' was here
> In file included from clogger.c:24:0:
> blocking_helpers.h:57:0: warning: "stat" redefined [enabled by default]

I might fix that aliasing independently in a few minutes...


On a side note: I hope to drop the C extension if the pure
Ruby version can offer acceptable performance nowadays.  I'd be
much happier if there's zero chance of somebody downloading an
unauditable pre-compiled binary.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gem fails to build on Win 7 32 bit, DevKit 3.7.2 (rubyinstaller.org)
  2016-07-25 21:04 ` Eric Wong
@ 2016-07-26  9:35   ` Ben Armstrong
  2016-07-26 15:24     ` Ben Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Armstrong @ 2016-07-26  9:35 UTC (permalink / raw)
  To: Eric Wong; +Cc: clogger-public

On 25/07/16 06:04 PM, Eric Wong wrote:
> Is the pure-Ruby version acceptable for you?
>
> I wonder if extconf.rb should just bail out with
>
> 	if RUBY_PLATFORM =~ /win32/i
> 	  raise "C ext not supported on RUBY_PLATFORM=#{RUBY_PLATFORM}"
> 	end

That might work for me, except there are several Windows platform
strings, and mine is i386-mingw32. In my test, I simply did an
unconditional raise and the gem built fine.

See:
http://stackoverflow.com/questions/170956/how-can-i-find-which-operating-system-my-ruby-program-is-running-on

However, after my successful build of the patched gem, when I re-enabled
clogger in my rails 3 app in config/application.rb like this, it
resulted in an empty log/access.log:

    config.middleware.use 'Clogger',
      :format => Clogger::Format::Combined,
      :logger => File.open("log/access.log", "ab")

Odd, as this worked fine for me once upon a time when the application
ran on Ruby 1.8.7. (It was only when we made the switch to Ruby 1.8.7 ->
2.2.4 that clogger broke and we temporarily disabled this feature.)

> if this can't be fixed...

Do you want to go that way anyway? I certainly could provide the
Makefile and mkmf.log, except ...

> On a side note: I hope to drop the C extension if the pure
> Ruby version can offer acceptable performance nowadays.  I'd be
> much happier if there's zero chance of somebody downloading an
> unauditable pre-compiled binary.


Sounds reasonable. If this is the way you're heading, I wonder if it's
worth the effort to debug the C.

Thanks,

Ben


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: gem fails to build on Win 7 32 bit, DevKit 3.7.2 (rubyinstaller.org)
  2016-07-26  9:35   ` Ben Armstrong
@ 2016-07-26 15:24     ` Ben Armstrong
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Armstrong @ 2016-07-26 15:24 UTC (permalink / raw)
  To: Eric Wong; +Cc: clogger-public

On 26/07/16 06:35 AM, Ben Armstrong wrote:
> However, after my successful build of the patched gem, when I re-enabled
> clogger in my rails 3 app in config/application.rb like this, it
> resulted in an empty log/access.log:
>
>      config.middleware.use 'Clogger',
>        :format => Clogger::Format::Combined,
>        :logger => File.open("log/access.log", "ab")
>
> Odd, as this worked fine for me once upon a time when the application
> ran on Ruby 1.8.7. (It was only when we made the switch to Ruby 1.8.7 ->
> 2.2.4 that clogger broke and we temporarily disabled this feature.)

This made me suspect that Rails was no longer passing this logger to 
WEBrick to use as an access log, and that had nothing at all to do with 
clogger. Sure enough, when I initialized the HTTPServer instance with 
:AccessLog => 
[[File.open('log/access.log','ab'),WEBrick::AccessLog::COMBINED_LOG_FORMAT]], 
I got exactly what I wanted, without having clogger involved at all.

So, thanks for your time looking at my issue, but I think I'll go with 
this solution, as it reduces my application's dependencies by one. If I 
ever need a logger with more flexibility, I'll keep clogger in mind, but 
it appears I don't need it.

Ben

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-26 15:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 15:07 gem fails to build on Win 7 32 bit, DevKit 3.7.2 (rubyinstaller.org) Ben Armstrong
2016-07-25 21:04 ` Eric Wong
2016-07-26  9:35   ` Ben Armstrong
2016-07-26 15:24     ` Ben Armstrong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/clogger.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).