From: Satoshi Shiba Date: 2010-04-13T21:40:07+09:00 Subject: [ruby-dev:40973] [BUG: trunk]arm-linux向けクロスコンパイル時のエラー 芝と申します. i686-linuxからarm-linux向けにクロスコンパイルをしようとしたところ, gc.h,gc.c,thread_pthread.cの3つのファイルでコンパイルエラーを確認しま した. キャストやマクロの定義,関数の宣言にちょっとしたミスがあるようです. クロスコンパイラはCodeSourceryさんのものを使用しています. http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite % ./configure --target=arm-linux --host=arm-linux --with-baseruby=ruby-1.9.2-dev CC=arm-none-linux-gnueabi-gcc LD=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar RANLIB=arm-none-linux-gnueabi-ranlib %make gc.c:1186: error: conflicting types for 'ruby_get_stack_grow_direction' gc.h:69: note: previous declaration of 'ruby_get_stack_grow_direction' was here gc.c: In function 'mark_current_machine_context': gc.c:2118: error: 'start' undeclared (first use in this function) gc.c:2118: error: (Each undeclared identifier is reported only once gc.c:2118: error: for each function it appears in.) gc.c:2118: error: 'end' undeclared (first use in this function) gc.c: In function 'rb_gc_mark_machine_stack': gc.c:2225: error: 'start' undeclared (first use in this function) gc.c:2225: error: 'end' undeclared (first use in this function) ... thread_pthread.c: In function 'get_stack': thread_pthread.c:224: error: invalid use of void expression 以下のパッチでコンパイルは通りました. Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 27328) +++ thread_pthread.c (working copy) @@ -190,7 +190,7 @@ #define STACK_DIR_UPPER(a,b) STACK_UPPER(0, a, b) #else #define STACK_GROW_DIR_DETECTION VALUE stack_grow_dir_detection -#define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, a, b) +#define STACK_DIR_UPPER(a,b) STACK_UPPER(&stack_grow_dir_detection, (a), (b)) #endif #if defined HAVE_PTHREAD_GETATTR_NP || defined HAVE_PTHREAD_ATTR_GET_NP @@ -221,7 +221,7 @@ # endif if (pthread_attr_getguardsize(&attr, &guard) == 0) { STACK_GROW_DIR_DETECTION; - STACK_DIR_UPPER((void)0, *addr = (char *)*addr + guard); + STACK_DIR_UPPER((void *)0, *addr = (char *)*addr + guard); *size -= guard; } # else Index: gc.c =================================================================== --- gc.c (revision 27328) +++ gc.c (working copy) @@ -2099,7 +2099,7 @@ #elif STACK_GROW_DIRECTION > 0 #define GET_STACK_BOUNDS(start, end, appendix) (start = STACK_START, end = STACK_END+appendix) #else -#define GET_STACK_BOUNDS(stack_start, stack_end, appendix) \ +#define GET_STACK_BOUNDS(start, end, appendix) \ ((STACK_END < STACK_START) ? \ (start = STACK_END, end = STACK_START) : (start = STACK_START, end = STACK_END+appendix)) #endif Index: gc.h =================================================================== --- gc.h (revision 27328) +++ gc.h (working copy) @@ -66,7 +66,7 @@ # define STACK_UPPER(x, a, b) b #else RUBY_EXTERN int ruby_stack_grow_direction; -int ruby_get_stack_grow_direction(VALUE *addr); +int ruby_get_stack_grow_direction(volatile VALUE *addr); # define stack_growup_p(x) ( \ (ruby_stack_grow_direction ? \ ruby_stack_grow_direction : \