You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Kevin Clark (JIRA)" <ji...@apache.org> on 2009/03/26 04:26:51 UTC

[jira] Updated: (THRIFT-408) Ruby C extension doesn't build on 1.8.5

     [ https://issues.apache.org/jira/browse/THRIFT-408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kevin Clark updated THRIFT-408:
-------------------------------

    Component/s:     (was: Compiler (Ruby))
                 Library (Ruby)
    Description: 
The C extension fails like so:

gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.9.1 -I/Users/kev/code/thrift/lib/rb/ext -DHAVE_STRLCPY  -fno-common -g -O2 -Wall -Werror  -c binary_protocol_accelerated.c
cc1: warnings being treated as errors
binary_protocol_accelerated.c: In function 'write_string_direct':
binary_protocol_accelerated.c:79: warning: implicit declaration of function 'RSTRING_LEN'
binary_protocol_accelerated.c: In function 'read_byte_direct':
binary_protocol_accelerated.c:227: warning: implicit declaration of function 'RSTRING_PTR'
binary_protocol_accelerated.c:227: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c: In function 'read_i16_direct':
binary_protocol_accelerated.c:232: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:232: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c: In function 'read_i32_direct':
binary_protocol_accelerated.c:237: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:238: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:239: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:240: error: subscripted value is neither array nor pointer


This is because RSTRING_LEN and RSTRING_PTR (and also RARRAY_LEN) aren't defined by Ruby (yet). Those macros were added to make it easier for alternate implementations to support C extensions. Anyway. We can fix them in an ifdef (one for each). RSTRING_LEN is equivalent to (if we want to cast..) {code}RSTRING(rb_String(some_macro_var))->len{code}. RSTIRNG_PTR is equivalent to {code}RSTRING(rb_String(some_macro_var))->ptr{code}. RARRAY_LEN is equivalent to {code}RARRAY(rb_Array(some_macro_var))->len{code}.

Should probably be put in macros.h and included in struct.c, memory_buffer.c, and binary_protocol_accelerated.c

  was:
The C extension fails like so:

gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.9.1 -I/Users/kev/code/thrift/lib/rb/ext -DHAVE_STRLCPY  -fno-common -g -O2 -Wall -Werror  -c binary_protocol_accelerated.c
cc1: warnings being treated as errors
binary_protocol_accelerated.c: In function 'write_string_direct':
binary_protocol_accelerated.c:79: warning: implicit declaration of function 'RSTRING_LEN'
binary_protocol_accelerated.c: In function 'read_byte_direct':
binary_protocol_accelerated.c:227: warning: implicit declaration of function 'RSTRING_PTR'
binary_protocol_accelerated.c:227: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c: In function 'read_i16_direct':
binary_protocol_accelerated.c:232: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:232: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c: In function 'read_i32_direct':
binary_protocol_accelerated.c:237: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:238: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:239: error: subscripted value is neither array nor pointer
binary_protocol_accelerated.c:240: error: subscripted value is neither array nor pointer


This is because RSTRING_LEN and RSTRING_PTR (and also RARRAY_LEN) aren't defined by Ruby (yet). Those macros were added to make it easier for alternate implementations to support C extensions. Anyway. We can fix them in an ifdef (one for each). RSTRING_LEN is equivalent to (if we want to cast..) RSTRING(rb_String(some_macro_var))->len. RSTIRNG_PTR is equivalent to RSTRING(rb_String(some_macro_var))->ptr. RARRAY_LEN is equivalent to RARRAY(rb_Array(some_macro_var))->len.

Should probably be put in macros.h and included in struct.c, memory_buffer.c, and binary_protocol_accelerated.c


> Ruby C extension doesn't build on 1.8.5
> ---------------------------------------
>
>                 Key: THRIFT-408
>                 URL: https://issues.apache.org/jira/browse/THRIFT-408
>             Project: Thrift
>          Issue Type: Bug
>          Components: Library (Ruby)
>    Affects Versions: 0.1
>            Reporter: Kevin Clark
>
> The C extension fails like so:
> gcc -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.9.1 -I/Users/kev/code/thrift/lib/rb/ext -DHAVE_STRLCPY  -fno-common -g -O2 -Wall -Werror  -c binary_protocol_accelerated.c
> cc1: warnings being treated as errors
> binary_protocol_accelerated.c: In function 'write_string_direct':
> binary_protocol_accelerated.c:79: warning: implicit declaration of function 'RSTRING_LEN'
> binary_protocol_accelerated.c: In function 'read_byte_direct':
> binary_protocol_accelerated.c:227: warning: implicit declaration of function 'RSTRING_PTR'
> binary_protocol_accelerated.c:227: error: subscripted value is neither array nor pointer
> binary_protocol_accelerated.c: In function 'read_i16_direct':
> binary_protocol_accelerated.c:232: error: subscripted value is neither array nor pointer
> binary_protocol_accelerated.c:232: error: subscripted value is neither array nor pointer
> binary_protocol_accelerated.c: In function 'read_i32_direct':
> binary_protocol_accelerated.c:237: error: subscripted value is neither array nor pointer
> binary_protocol_accelerated.c:238: error: subscripted value is neither array nor pointer
> binary_protocol_accelerated.c:239: error: subscripted value is neither array nor pointer
> binary_protocol_accelerated.c:240: error: subscripted value is neither array nor pointer
> This is because RSTRING_LEN and RSTRING_PTR (and also RARRAY_LEN) aren't defined by Ruby (yet). Those macros were added to make it easier for alternate implementations to support C extensions. Anyway. We can fix them in an ifdef (one for each). RSTRING_LEN is equivalent to (if we want to cast..) {code}RSTRING(rb_String(some_macro_var))->len{code}. RSTIRNG_PTR is equivalent to {code}RSTRING(rb_String(some_macro_var))->ptr{code}. RARRAY_LEN is equivalent to {code}RARRAY(rb_Array(some_macro_var))->len{code}.
> Should probably be put in macros.h and included in struct.c, memory_buffer.c, and binary_protocol_accelerated.c

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.