[ANN] Using RubyInline for Optimization

J

Joel VanderWerf

Tom said:
The "average" user might not care about InLine Ruby as much as you do...
I have a lot more to learn before I need InLine and by then it might be
worth DIY to get there.

If an "average" developer uses a library that depends on RubyInline,
then it becomes very important that it be easy to deploy ruby with
RubyInline working out of the box.
 
M

Mike Berrow

Eric said:
You need the MS C compiler.

Well, now I've downloaded and installed Visual C++ 2005 express
edition in order to get that. I also upgraded the RubyInline gem
to the latest, greatest 3.6.0 version.

I set INLINEDIR to
INLINEDIR=C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo

To verify that the C-compiler is operational, I commandline-compiled
the following example provided by Microsoft.

#include <iostream>
int main()
{
std::cout << "This is a native C++ program." << std::endl;
return 0;
}

with the line:
cl /EHsc simple.cpp
after running the env var setup script they refer you to.

That all works fine.

So, anyway, here is what RubyInline gives me now ...

C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo>ruby hello.rb
cl : Command line warning D9035 : option 'Og-' has been deprecated and
will be r
emoved in a future release
cl : Command line warning D9035 : option 'o' has been deprecated and
will be rem
oved in a future release
cl : Command line warning D9002 : ignoring unknown option '-G6'
c:/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.0/./inline.rb:404:in
`build': erro
r executing cl -nologo -LD -MD -Zi -O2b2xg- -G6 -I
c:/ruby/lib/ruby/1.8/i386-ms
win32 -o
"C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo/.ruby_inline/Inli
ne_Hello_5d41.so"
"C:/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.0/demo/.ruby_in
line/Inline_Hello_5d41.c" -link /LIBPATH:"c:/ruby/lib"
/DEFAULTLIB:"msvcrt-ruby
18.lib" /INCREMENTAL:no /EXPORT:Init_Inline_Hello_5d41: 512
(CompilationError)
Renamed
C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo/.ruby_inline/Inline
_Hello_5d41.c to
C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo/.ruby_inli
ne/Inline_Hello_5d41.c.bad from
c:/ruby/lib/ruby/gems/1.8/gems/RubyInline-3
6.0/./inline.rb:624:in `inline'
from hello.rb:7

Hmmm. Am I getting closer?
BTW. I am using the "One-Click Ruby Installer for Windows" as my Ruby
installation.

Thanks for any help,
-- Mike Berrow
 
M

Mike Berrow

Mike said:
...

Hmmm. Am I getting closer?
...

So ... no takers on this?

It would be hard to believe that I am the only one
that has (recently) tried to use RubyInline on Windows.

-- Mike
 
S

Sander Land

Mike Berrow wrote:
So ... no takers on this?

It would be hard to believe that I am the only one
that has (recently) tried to use RubyInline on Windows.

-- Mike

I only got it working after I recompiled ruby from sources using a
combination of cygwin and mingw, and even then I still had to patch
rubyinline to work with mingw.
Are you able to compile extensions using mkmf? If you can do that you
can try comparing the compile commands and adding the missing flags to
rubyinline.
 
E

Eric Hodel

Eric said:
You need the MS C compiler.

Well, now I've downloaded and installed Visual C++ 2005 express
edition in order to get that. I also upgraded the RubyInline gem
to the latest, greatest 3.6.0 version.

[...]

So, anyway, here is what RubyInline gives me now ...

C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo>ruby hello.rb
cl : Command line warning D9035 : option 'Og-' has been deprecated and
will be r
emoved in a future release
cl : Command line warning D9035 : option 'o' has been deprecated and
will be rem
oved in a future release
cl : Command line warning D9002 : ignoring unknown option '-G6'
c:/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.0/./inline.rb:404:in
`build': erro
r executing cl -nologo -LD -MD -Zi -O2b2xg- -G6 -I
c:/ruby/lib/ruby/1.8/i386-ms
win32 -o
"C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo/.ruby_inline/
Inli
ne_Hello_5d41.so"
"C:/ruby/lib/ruby/gems/1.8/gems/RubyInline-3.6.0/demo/.ruby_in
line/Inline_Hello_5d41.c" -link /LIBPATH:"c:/ruby/lib"
/DEFAULTLIB:"msvcrt-ruby
18.lib" /INCREMENTAL:no /EXPORT:Init_Inline_Hello_5d41: 512
(CompilationError)
Renamed
C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo/.ruby_inline/
Inline
_Hello_5d41.c to
C:\ruby\lib\ruby\gems\1.8\gems\RubyInline-3.6.0\demo/.ruby_inli
ne/Inline_Hello_5d41.c.bad from
c:/ruby/lib/ruby/gems/1.8/gems/RubyInline-3
.6.0/./inline.rb:624:in `inline'
from hello.rb:7

Hmmm. Am I getting closer?

Did you build ruby with this compiler?
BTW. I am using the "One-Click Ruby Installer for Windows" as my Ruby
installation.

... no

You need to use the same compiler for building both Ruby and any
extensions, inline or not.

The simple solution, now that you have a compiler, is to build and
install a new ruby.
 
E

Eric Hodel

If an "average" developer uses a library that depends on
RubyInline, then it becomes very important that it be easy to
deploy ruby with RubyInline working out of the box.

RubyInline has the ability to create a gem that includes the built
library removing the need to install a compiler.
 
M

Mike Berrow

Eric said:
You need to use the same compiler for building both Ruby and any
extensions, inline or not.

The simple solution, now that you have a compiler, is to build and
install a new ruby.

Sigh ... I get the picture.

I guess that means I have to abandon all the fine work done by
Curt Hibbs on the one-click installer and start from scratch.
I am not an ace with C makefiles etc. these days so I sense that
could be a tough road.

Would it be easier to track down the exact C compiler used by
Curt and install that instead?.

Thanks for your help,
-- Mike Berrow
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top