rfuzz compile error in ruby 1.9.2
I am trying to compile the c extension for rfuzz. The error i get is
make gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64 -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -o http11_client.o -c http11_client.c
http11_client.c: In function ‘client_http_field’:
http11_client.c:36:22: error: ‘struct RString’ has no member named ‘ptr’
http11_client.c:36:50: error: ‘struct RString’ has no member named ‘len’
http11_client.c: In function ‘HttpClientParser_execute’:
http11_client.c:218:23: error: ‘struct RString’ has no member named ‘ptr’
http11_client.c:219:23: error: ‘struct RString’ has no member named ‘len’
make: *** [http11_client.o] Error 1
RString is in Ruby.h. The struct in ruby.h does indeed have those members.
struct RString {
struct RBasic basic;
union {
struct {
long len;
char *ptr;
union {
开发者_JAVA技巧 long capa;
VALUE shared;
} aux;
} heap;
char ary[RSTRING_EMBED_LEN_MAX + 1];
} as;
};
What am I missing?
Looks like RFuzz isn't compatible with Ruby 1.9.2. The RString
definition for 1.9.2 is as you listed but for 1.8.7 it looks like this:
struct RString {
struct RBasic basic;
long len;
char *ptr;
union {
long capa;
VALUE shared;
} aux;
};
which matches what the RFuzz source seems to be looking for. So you can either drop down to 1.8 for using RFuzz or you can try to port RFuzz to work with newer versions of Ruby.
The RFuzz website doesn't appear to have been updated since 2006 so it might not be maintained at all anymore.
I don't know the ruby source code; just by looking at what you posted:
The type struct RString
has 2 members: basic
(of type struct RBasic
) and as
(of untagged union type).
The untagged union identified by as
has 2 members: heap
of untagged struct type and ary
of array of char type.
The untagged struct identified by heap
has the ptr
member.
So to reach it you need
struct RString x;
x.as.heap.ptr; /* this is a char* */
精彩评论