2012年04月21日 mruby on zaurus [長年日記]
_ mruby on zaurus
軽量rubyらしい。zaurusで動けば嬉しいのだが...
gcc -Wall -Werror-implicit-function-declaration -g -MMD -I../../src -I../../src/../include -c ../../src/st.c -o ../../src/st.o ../../src/st.c: In function 'st_hash': ../../src/st.c:1053: error: 'SIZEOF_ST_INDEX_T' undeclared (first use in this function) ../../src/st.c:1053: error: (Each undeclared identifier is reported only once ../../src/st.c:1053: error: for each function it appears in.) make[2]: *** [../../src/st.o] Error 1 make[1]: *** [../bin/mrbc] Error 2 make: *** [src/mrblib/mrblib.o] Error 2
SIZEOF_ST_INDEX_Tがどこにも定義されていない?
解決
Mac OSXでも同じ状況だった様子。対応がめちゃくちゃ早い。
--- a/src/st.c +++ b/src/st.c @@ -963,6 +963,8 @@ strhash(st_data_t arg) #define MURMUR 2 #endif +#define SIZEOF_ST_INDEX_T __WORDSIZE + #if MURMUR == 1 #define MurmurMagic 0xc6a4a793 #elif MURMUR == 2
また引っかかった
リンク段階でエラー。
make: built targets of /home/m-ito/tmp/mruby-mruby-9718925/mrblib gcc -o ../../bin/mruby ../../src/../tools/mruby/mruby.o ../../src/array.o ../../src/ascii.o ../../src/class.o ../../src/codegen.o ../../src/compar.o ../../src/crc.o ../../src/encoding.o ../../src/enum.o ../../src/error.o ../../src/etc.o ../../src/gc.o ../../src/hash.o ../../src/init.o ../../src/init_ext.o ../../src/kernel.o ../../src/load.o ../../src/numeric.o ../../src/object.o ../../src/pool.o ../../src/print.o ../../src/proc.o ../../src/range.o ../../src/re.o ../../src/regcomp.o ../../src/regenc.o ../../src/regerror.o ../../src/regexec.o ../../src/regparse.o ../../src/sprintf.o ../../src/st.o ../../src/state.o ../../src/string.o ../../src/struct.o ../../src/symbol.o ../../src/transcode.o ../../src/unicode.o ../../src/us_ascii.o ../../src/utf_8.o ../../src/variable.o ../../src/version.o ../../src/vm.o ../../src/y.tab.o ../../src/../mrblib/mrblib.o -lm ../../src/../mrblib/mrblib.o: In function `mrb_init_mrblib': /home/m-ito/tmp/mruby-mruby-9718925/mrblib/mrblib.c:16: undefined reference to mrblib_irep' collect2: ld returned 1 exit status make[1]: *** [../../bin/mruby] Error 1 make: *** [src/init_ext.o] Error 2
実は少し前の段階で
make: built targets of /home/m-ito/tmp/mruby-mruby-9718925/tools/mrbc cat array.rb compar.rb enum.rb error.rb hash.rb kernel.rb numeric.rb print.rb range.rb string.rb struct.rb > mrblib.rbtmp ../bin/mrbc -Bmrblib_irep -omrblib.ctmp mrblib.rbtmp; cat init_mrblib.c mrblib.ctmp > mrblib.c /bin/sh: line 1: 8007 Segmentation fault ../bin/mrbc -Bmrblib_irep -omrblib.ctmp mrblib.rbtmp
セグっている。なぜ?
とりあえずgdbをかけた結果を貼っておく。
10027 m-ito@c860:~/tmp/mruby-mruby-9718925/mrblib$ gdb ../bin/mrbc GNU gdb (GDB) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-slackware-linux-gnueabi". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /home/m-ito/tmp/mruby-mruby-9718925/bin/mrbc...done. (gdb) run -Bmrblib_irep -omrblib.ctmp mrblib.rbtmp Starting program: /home/m-ito/tmp/mruby-mruby-9718925/bin/mrbc -Bmrblib_irep -omrblib.ctmp mrblib.rbtmp Program received signal SIGSEGV, Segmentation fault. 0x000ae9f4 in parser_yylex (p=0x11fb90) at ../../src/parse.y:4406 4406 if (!identchar(c)) { (gdb) list 4401 case '_': 4402 newtok(p); 4403 break; 4404 4405 default: 4406 if (!identchar(c)) { 4407 yyerror_i(p, "Invalid char `\\x%02X' in expression", c); 4408 goto retry; 4409 } 4410 (gdb) quit A debugging session is active. Inferior 1 [process 8052] will be killed. Quit anyway? (y or n) y 10028 m-ito@c860:~/tmp/mruby-mruby-9718925/mrblib$
解決!(2012.6.29 追記)
#define ALLOC_ALIGN 4
を、src/pool.cの先頭に追加で解決(^^)d