Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Windows 7 - building win32/api gem

Reply
Thread Tools

Windows 7 - building win32/api gem

 
 
Stanislaw Wozniak
Guest
Posts: n/a
 
      03-03-2009
Hi Guys,

I have been trying to install win32-api 1.4.0 gem on windows 7 x64 but
no success.

When i install x86 version, require 'win32/api' gives me following
error:

LoadError: 193: %1 is not a valid Win32 application. -
c:/ruby/lib/ruby/gems/1.9.1/gems/win32-api-1.4.0-x86-mswin32-60/lib/win32/api.so
from (irb):1:in `require'
from (irb):1
from c:/ruby/bin/irb.bat:20:in `<main>'

My ruby:
ruby 1.9.1p0 (2009-01-30 revision 21907) [x64-mswin64_80]

My gems:
1.3.1

I have VS2008 installed and even managed to create a makefile but it
complains about following:

C:\>gem install win32-api
Building native extensions. This could take a while...
ERROR: Error installing win32-api:
ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb install win32-api
checking for strncpy_s()... yes
creating Makefile

nmake

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

c:\ruby\bin\ruby -e "puts 'EXPORTS', 'Init_api'" >
api-x64-mswin64_80.def
cl -nologo -I. -Ic:/ruby/include/ruby-1.9.1/x64-mswin64_80
-Ic:/ruby/include/ruby-1.9.1/ruby/backward -Ic:/ruby/include/ruby-1.9.1
-Iwin32 -MD -Zi -O2b
2xty- -Zm600 -DHAVE_STRNCPY_S -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE -Foapi.obj -c -Tcwin32/api.c
api.c
cl -nologo -LD -Feapi.so api.obj msvcr80-ruby191.lib
oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib -link
-incremental:no -debug -opt:re
f -opt:icf -dll -libpath:"." -libpath:"c:/ruby/lib"
-implib:api-x64-mswin64_80.lib -pdb:api-x64-mswin64_80.pdb
-def:api-x64-mswin64_80.def
Creating library api-x64-mswin64_80.lib and object
api-x64-mswin64_80.exp
api.obj : error LNK2019: unresolved external symbol _rb_num2long
referenced in function _NUM2LONG
api.obj : error LNK2019: unresolved external symbol _rb_int2big
referenced in function _LONG2NUM
api.obj : error LNK2019: unresolved external symbol _rb_uint2big
referenced in function _ULONG2NUM
api.obj : error LNK2019: unresolved external symbol
_rb_data_object_alloc referenced in function _api_allocate
api.obj : error LNK2019: unresolved external symbol _rb_raise referenced
in function _StringError
api.obj : error LNK2019: unresolved external symbol _rb_iv_set
referenced in function _callback_init
api.obj : error LNK2019: unresolved external symbol _rb_str_new_cstr
referenced in function _callback_init
api.obj : error LNK2019: unresolved external symbol _rb_scan_args
referenced in function _callback_init
api.obj : error LNK2019: unresolved external symbol _rb_string_value_ptr
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_str_cat
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_str_new_shared
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_check_safe_obj
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_string_value
referenced in function _api_init
api.obj : error LNK2001: unresolved external symbol __imp__rb_eArgError
api.obj : error LNK2019: unresolved external symbol _rb_ary_push
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_ary_new
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_str_split
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_respond_to
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_intern
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_check_type
referenced in function _api_init
api.obj : error LNK2019: unresolved external symbol _rb_str_modify
referenced in function _CallbackFunction
api.obj : error LNK2019: unresolved external symbol _rb_num2ulong
referenced in function _CallbackFunction
api.obj : error LNK2019: unresolved external symbol _rb_funcall2
referenced in function _CallbackFunction
api.obj : error LNK2019: unresolved external symbol _rb_iv_get
referenced in function _CallbackFunction
api.obj : error LNK2019: unresolved external symbol _rb_str_new
referenced in function _api_call
api.obj : error LNK2019: unresolved external symbol _rb_define_const
referenced in function _Init_api
api.obj : error LNK2019: unresolved external symbol _rb_define_attr
referenced in function _Init_api
api.obj : error LNK2019: unresolved external symbol _rb_define_method
referenced in function _Init_api
api.obj : error LNK2019: unresolved external symbol
_rb_define_alloc_func referenced in function _Init_api
api.obj : error LNK2001: unresolved external symbol
__imp__rb_eRuntimeError
api.obj : error LNK2019: unresolved external symbol
_rb_define_class_under referenced in function _Init_api
api.obj : error LNK2001: unresolved external symbol __imp__rb_cObject
api.obj : error LNK2019: unresolved external symbol _rb_define_module
referenced in function _Init_api
api.so : fatal error LNK1120: 33 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
Studio 9.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.


Gem files will remain installed in
c:/ruby/lib/ruby/gems/1.9.1/gems/win32-api-1.4.0 for inspection.
Results logged to
c:/ruby/lib/ruby/gems/1.9.1/gems/win32-api-1.4.0/ext/gem_make.out


Does anyone have any idea about building gem on windows? Or maybe you
have precompiled api.so on your x64 system.

I would appreciate your help.
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Heesob Park
Guest
Posts: n/a
 
      03-03-2009
Hi,

2009/3/3 Stanislaw Wozniak <(E-Mail Removed)>:
> Hi Guys,
>
> I have been trying to install win32-api 1.4.0 gem on windows 7 x64 but
> no success.
>
> When i install x86 version, require 'win32/api' gives me following
> error:
>
> LoadError: 193: %1 is not a valid Win32 application. =C2=A0 -
> c:/ruby/lib/ruby/gems/1.9.1/gems/win32-api-1.4.0-x86-mswin32-60/lib/win32=

/api.so
> =C2=A0 =C2=A0 =C2=A0 =C2=A0from (irb):1:in `require'
> =C2=A0 =C2=A0 =C2=A0 =C2=A0from (irb):1
> =C2=A0 =C2=A0 =C2=A0 =C2=A0from c:/ruby/bin/irb.bat:20:in `<main>'
>
> My ruby:
> ruby 1.9.1p0 (2009-01-30 revision 21907) [x64-mswin64_80]
>
> My gems:
> 1.3.1
>
> I have VS2008 installed and even managed to create a makefile but it
> complains about following:
>
> C:\>gem install win32-api
> Building native extensions. =C2=A0This could take a while...
> ERROR: =C2=A0Error installing win32-api:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0ERROR: Failed to build gem native extension.
>
> c:/ruby/bin/ruby.exe extconf.rb install win32-api
> checking for strncpy_s()... yes
> creating Makefile
>
> nmake
>
> Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
> Copyright (C) Microsoft Corporation. =C2=A0All rights reserved.
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0c:\ruby\bin\ruby -e "puts 'EXPORTS', 'Init_api=

'" =C2=A0>
> api-x64-mswin64_80.def
> =C2=A0 =C2=A0 =C2=A0 =C2=A0cl -nologo -I. -Ic:/ruby/include/ruby-1.9.1/x6=

4-mswin64_80
> -Ic:/ruby/include/ruby-1.9.1/ruby/backward -Ic:/ruby/include/ruby-1.9.1
> -Iwin32 -MD -Zi =C2=A0-O2b
> 2xty- =C2=A0-Zm600 -DHAVE_STRNCPY_S -D_CRT_SECURE_NO_DEPRECATE
> -D_CRT_NONSTDC_NO_DEPRECATE -Foapi.obj -c -Tcwin32/api.c
> api.c

...
>
> Does anyone have any idea about building gem on windows? Or maybe you
> have precompiled api.so on your x64 system.
>

I guess you tried to build win32-api module with Visual C++ 9.0.
You must use the same compiler with the Ruby version(x64-mswin64_80).
After some trials and errors, I managed to build win32-api module with
Visual C++ 8.0.
You can download at http://121.78.227.9/win32-api-1.4.0/lib/win32/api.so

NB, Using win32utils on the 64bit Ruby is not tested.

Regards,

Park Heesob

 
Reply With Quote
 
 
 
 
Stanislaw Wozniak
Guest
Posts: n/a
 
      03-03-2009
Thanks for your help, it worked like a charm.

For my future reference, is VC++ 8.0 included in Visual Studio 2005?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Stanislaw Wozniak
Guest
Posts: n/a
 
      03-03-2009
And BTW, would you mind sharing how to setup build environment and how
to build extensions on windows? I am installing VS2005 as we speak
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
Heesob Park
Guest
Posts: n/a
 
      03-04-2009
Hi,

2009/3/4 Stanislaw Wozniak <(E-Mail Removed)>:
> And BTW, would you mind sharing how to setup build environment and how
> to build extensions on windows? I am installing VS2005 as we speak


Build environment is just Visual Studio 2005 x64 command prompt.

The ruby 1.9.1p0 (2009-01-30 revision 21907) [x64-mswin64_80] distribution lacks
win32.h file in \include\ruby-1.9.1\ruby folder.
Coping win32.h from ruby 1.9.1p0 source code to the above folder is required.

This subject is more suitable on win32utils-devel mailing list.
Please join at http://rubyforge.org/mail/?group_id=85 for more discussion.

Regards,

Park Heesob

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RubyGems 0.9.1 calling a gem with gem '<gem>' Austin 7873 Ruby 5 01-27-2007 10:05 PM
gem.cmd install RMagick-win32-1.9.2-mswin32.gem: Buffer error Clifford Heath Ruby 7 06-09-2006 07:02 PM
[GEM PATCH] allow gem to install bin file to different location Ara.T.Howard Ruby 0 10-26-2005 11:52 PM
ERROR: While executing gem ... (Gem::GemNotFoundException) Could not find rubygems-upodate (> 0) in the repository han Ruby 1 10-24-2005 10:28 PM
[ANN] Getopt-Declare 1.12 (gem/zip) and GGEnv (gem/zip) gga Ruby 0 07-18-2005 03:21 PM



Advertisments