KyotoTycoon+LuaJIT-2.0ã«ããã
é常ã«ããããªãããæ¹ããã¦ãã¾ãã¾ããï¼
ãã®ä¸ã§ãªã人ãKyotoTycoonï¼KyotoCabinetã使ãï¼ãã®ä¸ã§ãªã人ãLua-5.2ã§ã¯ãªãLuaJIT-2.0ã使ã£ã¦ãããã¨ãï¼
ããã¾ã§åãã¦ããã·ã¹ãã ãï¼ãµã¨åããªããªãã¾ããï¼
å¤å°ä½ãããã ã·ã¹ãã ã ã£ãã®ã§ï¼ä½ãããããã®ããåãããããã ãã§æéãããã£ãã®ã§ããï¼æçµçã«ç¢ºå®ã«è½ã¡ããã¤ã³ããçºè¦ï¼
$ ./ktserver -li -scr example/ktscrjsonex.lua 2012-11-22T13:01:46.270057+09:00: [SYSTEM]: ================ [START]: pid=406 2012-11-22T13:01:46.270273+09:00: [SYSTEM]: opening a database: path=: 2012-11-22T13:01:46.270391+09:00: [SYSTEM]: loading a script file: path=example/ktscrjsonex.lua Segmentation fault
ktscrjsonex.luaã¯ï¼KyotoTycoonã«æ¨æºã§ä»å±ããã¦ããã¹ã¯ãªããã§ãï¼ãããSegmentation faultï¼
ã¨ã©ã¼ã«ãªãå ´æãç¹å®ãã¹ãï¼gdbã§ktserverãç«ã¡ããï¼å®è¡ï¼
#1 0x00000000005074be in lj_mem_realloc (L=0x0, p=0x40005a20, osz=5455666, nsz=0) at lj_gc.c:803 #2 0x00000000004f06b6 in lj_str_new (L=0x40000378, str=0x400053c8 "luaJIT_BC_json", lenx=<value optimized out>) at lj_str.c:152
ã³ã³âlj_mem_realloc (L=0x0, p=0x40005a20, osz=5455666, nsz=0)ï¼
luaã®APIã§ã¯ï¼æåã®å¼æ°ã§Luaã®ç¶æ
ã示ãã¹ãã¼ã¿ã¹å¤æ°ãå
¥ãã®ã§ããï¼ãããL=0x0ã«ãªã£ã¦ãã¾ãï¼
çµå±ã¯ï¼Luaã¹ã¯ãªããã§ï¼å
¨ã¦ã®require()ãã¨ã©ã¼ã«ãªããã¨ãåããã¾ããï¼
èãããããï¼KyotoTycoonãLuaJITããã£ã¤ãã¦ã³ã³ãã¤ã«ããæã«ï¼ããæ°ãªãè¦åãåºã¦ããã®ã«æ°ä»ãã¾ããï¼
g++ -m64 -g -O2 -Wall -fPIC -fsigned-char -g0 -O2 -o ktremotemgr ktremotemgr.o -L. -L/usr/local/proad/dyson/tools/lib -L. -L/usr/local/proad/dyson/tools/lib -L/usr/local/lib -L/usr/lib/lua-5.1 -L/usr/local/lib/lua-5.1 -L/usr/lib/lua -L/usr/local/lib/lua -L/usr/local/proad/dyson/tools/lib -Wl,-rpath-link,.:/usr/local/lib:.:/usr/local/lib::/usr/lib/lua-5.1:/usr/local/lib/lua-5.1:/usr/lib/lua:/usr/local/lib/lua:/usr/local/proad/dyson/tools/lib -Wl,--as-needed -static -lkyototycoon -lkyotocabinet -lluajit-5.1 -lkyotocabinet -llzma -llzo2 -lz -lstdc++ -lresolv -lnsl -ldl -lrt -lpthread -lm -lc ./libkyototycoon.a(ktsocket.o): In function `kyototycoon::Socket::get_host_address(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': ktsocket.cc:(.text+0x1013): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking #================================================================ # Ready to install. #================================================================
ã warning: Using 'getaddrinfo' in statically linked applications requires at runtimeãï¼ï¼ï¼ï¼ï¼
ããï¼KyotoTycoonã®ã³ã³ãã¤ã«æã«ï¼configureã§--enable-staticãä»ããã¨ï¼ãããªãã¾ããï¼
éã«ï¼--enable-staticãä»ããªãã£ããï¼ï¼ï¼å
¨ã¦ã®ã¨ã©ã¼ãæ¶ãã¾ããï¼ï¼ï¼require()ã使ããããã«ãªãã¾ããï¼
ãã£ãããªã®ã§ï¼KyotoTycoonã®configureãLuaJIT対å¿ã«ããããããæ¸ãã¾ããï¼
使ãæ¹ã¯ãããªæãã§ãï¼
$ patch < configure.patch env LDFLAGS='-L/usr/local/lib -llzo2' CPPFLAGS=-I/usr/local/include ./configure --prefix=/usr/local --with-kc=/usr/local --enable-lua
ããããã¡ã¤ã«ã¯ãããªæãã§ãï¼
*** configure.orig 2012-05-02 22:04:11.000000000 +0900 --- configure 2012-11-22 14:32:46.000000000 +0900 *************** *** 2248,2254 **** if test "$enable_lua" = "yes" then ! luaver=`lua -e 'v = string.gsub(_VERSION, ".* ", ""); print(v)'` MYCPPFLAGS="$MYCPPFLAGS -D_MYLUA" MYCPPFLAGS="$MYCPPFLAGS -I/usr/include/lua$luaver -I/usr/local/include/lua$luaver" MYCPPFLAGS="$MYCPPFLAGS -I/usr/include/lua -I/usr/local/include/lua" --- 2248,2254 ---- if test "$enable_lua" = "yes" then ! luaver=-`luajit -e 'v = string.gsub(_VERSION, ".* ", ""); print(v)'` MYCPPFLAGS="$MYCPPFLAGS -D_MYLUA" MYCPPFLAGS="$MYCPPFLAGS -I/usr/include/lua$luaver -I/usr/local/include/lua$luaver" MYCPPFLAGS="$MYCPPFLAGS -I/usr/include/lua -I/usr/local/include/lua" *************** *** 3999,4005 **** $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS ! LIBS="-llua $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ --- 3999,4005 ---- $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS ! LIBS="-lluajit $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ *************** *** 4024,4030 **** { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_main" >&5 $as_echo "$ac_cv_lib_lua_main" >&6; } if test "x$ac_cv_lib_lua_main" = xyes; then : ! MYCMDLIBS="$MYCMDLIBS -llua" fi as_ac_Lib=`$as_echo "ac_cv_lib_lua$luaver''_main" | $as_tr_sh` --- 4024,4030 ---- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lua_main" >&5 $as_echo "$ac_cv_lib_lua_main" >&6; } if test "x$ac_cv_lib_lua_main" = xyes; then : ! MYCMDLIBS="$MYCMDLIBS -lluajit" fi as_ac_Lib=`$as_echo "ac_cv_lib_lua$luaver''_main" | $as_tr_sh` *************** *** 4034,4040 **** $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS ! LIBS="-llua$luaver $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ --- 4034,4040 ---- $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS ! LIBS="-lluajit$luaver $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ *************** *** 4060,4066 **** { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then : ! MYCMDLIBS="$MYCMDLIBS -llua$luaver" fi fi