Compiling Ruby C extension on windows problem

H

Harry Spier

Dear list members,

I am using a Windows-XP box with Ruby 1.8.6 installed with the
one-click-installer.

I am trying to get a simple example of a C extension to Ruby to compile
on Windows.
I'm trying to get recipe 22.1 in the Ruby Cookbook to work but I am
having trouble with the "make" step.

As per the recipe I've created an extconf.rb
# extconf.rb
require 'mkmf'

dir_config('example')
create_makefile('example')

And also the simple example.c in the book
#include <ruby.h>
#include <stdio.h>

static VALUE rb_mExample;
static VALUE rb_cClass;

static VALUE
print_string(VALUE class, VALUE arg)
{
printf("%s", RSTRING(arg)->ptr);
return Qnil;
}
void
Init_example()
{
rb_mExample = rb_define_module("Example");

rb_cClass = rb_define_class_under(rb_mExample, "Class", rb_cObject);

rb_define_method(rb_cClass, "print_string", print_string, 1);
}

I then run extconf.rb which creates the Makefile for me.

But when I then run make I get the error:
target pattern contains no '%' stop



I've done some searching on the internet and it appears that other
people have had this error and it seems to be that this error occurs
because "make" doesn't recognize dos path names anymore . I saw a note
that this is only since make 1.80 and that 1.79 works but I tried make
1.79 and I still get the error. I've tried this with "make" from MinGW,
MinGW Msys, and also with "make" from Cygwin but I still get the error.

I haven't seen anywhere on the internet how to fix this problem. Does
anyone know how I can get "make" to work? Perhaps modifying mkmf.rb or
editting the Makefile it creates?

Thanks,
Harry
 
N

Nobuyoshi Nakada

Hi,

At Thu, 3 May 2007 06:42:26 +0900,
Harry Spier wrote in [ruby-talk:250001]:
I am using a Windows-XP box with Ruby 1.8.6 installed with the
one-click-installer.
But when I then run make I get the error:
target pattern contains no '%' stop

Makefile created with One-click-installer isn't for
cygwin/mingw.
You have to build ruby by yourself.
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top