win32-service coludn't be compiled

247 views
Skip to first unread message

graf0

unread,
Mar 13, 2010, 9:01:07 AM3/13/10
to RubyInstaller
Hello

I'm trying to compile win32-service gem, but I get:
Building native extensions. This could take a while...
ERROR: Error installing win32-service:
ERROR: Failed to build gem native extension.

C:/Ruby/bin/ruby.exe extconf.rb
checking for RegisterServiceCtrlHandlerEx()... yes
creating Makefile

make
gcc -I. -I. -IC:/Ruby/lib/ruby/1.8/i386-mingw32 -I. -
DHAVE_REGISTERSERVICECTRLHA
NDLEREX -g -O2 -c win32/daemon.c
win32/daemon.c: In function `Ruby_Service_Ctrl':
win32/daemon.c:142: error: `__try' undeclared (first use in this
function)
win32/daemon.c:142: error: (Each undeclared identifier is reported
only once
win32/daemon.c:142: error: for each function it appears in.)
win32/daemon.c:142: error: syntax error before '{' token
win32/daemon.c:169: error: `__finally' undeclared (first use in this
function)
win32/daemon.c:169: error: syntax error before '{' token
win32/daemon.c: At top level:
win32/daemon.c:174: error: conflicting types for 'rb_thread_polling'
C:/Ruby/lib/ruby/1.8/i386-mingw32/intern.h:217: error: previous
declaration of '
rb_thread_polling' was here
win32/daemon.c:174: error: conflicting types for 'rb_thread_polling'
C:/Ruby/lib/ruby/1.8/i386-mingw32/intern.h:217: error: previous
declaration of '
rb_thread_polling' was here
win32/daemon.c:174: warning: data definition has no type or storage
class
win32/daemon.c:175: error: syntax error before '}' token
win32/daemon.c: In function `Service_Ctrl':
win32/daemon.c:200: error: `__try' undeclared (first use in this
function)
win32/daemon.c:200: error: syntax error before '{' token
win32/daemon.c: At top level:
win32/daemon.c:205: error: syntax error before '{' token
win32/daemon.c:235: error: syntax error before numeric constant
win32/daemon.c:235: error: conflicting types for 'SetTheServiceStatus'
win32/daemon.c:50: error: previous declaration of
'SetTheServiceStatus' was here

win32/daemon.c:235: error: conflicting types for 'SetTheServiceStatus'
win32/daemon.c:50: error: previous declaration of
'SetTheServiceStatus' was here

win32/daemon.c:235: warning: data definition has no type or storage
class
win32/daemon.c:249: error: conflicting types for 'SetTheServiceStatus'
win32/daemon.c:235: error: previous declaration of
'SetTheServiceStatus' was her
e
win32/daemon.c:249: error: conflicting types for 'SetTheServiceStatus'
win32/daemon.c:235: error: previous declaration of
'SetTheServiceStatus' was her
e
make: *** [daemon.o] Error 1


Gem files will remain installed in C:/Ruby/lib/ruby/gems/1.8/gems/
win32-service-
0.7.1 for inspection.
Results logged to C:/Ruby/lib/ruby/gems/1.8/gems/win32-service-0.7.1/
ext/gem_mak
e.out

I've installed latest rubyinstaller & devkit.

Cheers

Luis Lavena

unread,
Mar 13, 2010, 9:07:15 AM3/13/10
to rubyin...@googlegroups.com
On Sat, Mar 13, 2010 at 3:01 PM, graf0 <gr...@post.pl> wrote:
> Hello
>
> I'm trying to compile win32-service gem, but I get:
> Building native extensions.  This could take a while...
> ERROR:  Error installing win32-service:
>        ERROR: Failed to build gem native extension.
>

win32-service has been coded in a way that requires a functionality
only available under Microsoft Visual C compilers, which is not ANSI C
compliant. It is called SEH

This was raised before in the list:

http://groups.google.com/group/rubyinstaller/msg/450ddb1540d7f411

And I believe is something that win32utils team is already aware.

See the open issues in their current tracker.

http://rubyforge.org/projects/win32utils/

>
> I've installed latest rubyinstaller & devkit.
>
> Cheers
>

Until these incompatibilities are removed there is nothing we can do.

--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Alexey Borzenkov

unread,
Mar 13, 2010, 9:24:21 AM3/13/10
to rubyin...@googlegroups.com
On Sat, Mar 13, 2010 at 5:01 PM, graf0 <gr...@post.pl> wrote:
> Hello
>
> I'm trying to compile win32-service gem, but I get:
> Building native extensions.  This could take a while...
> ERROR:  Error installing win32-service:
>        ERROR: Failed to build gem native extension.

That's because win32-service is using SEH exception handling that is
currently only supported by Microsoft Visual C++. If you really want
to build it using gcc you can adapt something like my patch at:

http://git.kitsu.ru/patched/ruby/win32-service.git/commitdiff/e056177c8762c403755aecff6d202b0f0828e903

SEH in win32-service appears to be used mostly for ensuring that
critical sections are released, so __try/__finally in my patch are
replaced by C++ destructors that do almost the same thing.

Bear in mind, however, that gcc/mingw is not using SEH for C++
exceptions, so unlike __try/__finally any win32 exceptions (like
dereferencing a null-pointer), won't be handled. On the other hand it
shouldn't matter much, since SEH exceptions would bubble up and thread
will exit, effectively releasing critical sections on its way out. :)
Another disadvantage is that my patch is forced to use C++. :-/

But if you are using 1.8.6/1.8.7 you can try installing official
binary for msvc ruby, most likely it will work really well.

Grzegorz Marszałek

unread,
Mar 13, 2010, 9:31:48 AM3/13/10
to rubyin...@googlegroups.com
Hello!

Thank you for answers.

> But if you are using 1.8.6/1.8.7 you can try installing official
> binary for msvc ruby, most likely it will work really well.


That's exactly what I did:

gem install win32-service --platform=mswin32

And yes, it works :)

Thanks again,
---
Grzegorz Marszałek
gr...@post.pl


Reply all
Reply to author
Forward
0 new messages