Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

编译binding/lua时报错 #64

Closed
wbdu opened this issue Aug 5, 2015 · 3 comments
Closed

编译binding/lua时报错 #64

wbdu opened this issue Aug 5, 2015 · 3 comments

Comments

@wbdu
Copy link

wbdu commented Aug 5, 2015

环境是mac osx Yosemite 10.10.4,openresty附带的luajit-2.1。

···
gcc -O2 -fPIC -Wall -shared -o protobuf.so -I../.. -I/usr/local/openresty/luajit/include/luajit-2.1 -L../../build pbc-lua.c -lpbc
Undefined symbols for architecture x86_64:
"_luaL_checkinteger", referenced from:
__rmessage_new in pbc-lua-cc4638.o
__rmessage_integer in pbc-lua-cc4638.o
__rmessage_int32 in pbc-lua-cc4638.o
__rmessage_int64 in pbc-lua-cc4638.o
__rmessage_int52 in pbc-lua-cc4638.o
__rmessage_uint52 in pbc-lua-cc4638.o
__rmessage_real in pbc-lua-cc4638.o
...
"_luaL_checklstring", referenced from:
__env_register in pbc-lua-cc4638.o
__env_type in pbc-lua-cc4638.o
__rmessage_new in pbc-lua-cc4638.o
__rmessage_integer in pbc-lua-cc4638.o
__rmessage_int32 in pbc-lua-cc4638.o
__rmessage_int64 in pbc-lua-cc4638.o
__rmessage_int52 in pbc-lua-cc4638.o
...
"_luaL_checknumber", referenced from:
__wmessage_real in pbc-lua-cc4638.o
__wmessage_int52 in pbc-lua-cc4638.o
__wmessage_uint52 in pbc-lua-cc4638.o
__pattern_pack in pbc-lua-cc4638.o
"_luaL_checktype", referenced from:
__decode in pbc-lua-cc4638.o
"_luaL_error", referenced from:
__env_register in pbc-lua-cc4638.o
__env_type in pbc-lua-cc4638.o
__rmessage_new in pbc-lua-cc4638.o
__rmessage_delete in pbc-lua-cc4638.o
__rmessage_integer in pbc-lua-cc4638.o
__rmessage_int32 in pbc-lua-cc4638.o
__rmessage_int64 in pbc-lua-cc4638.o
...
"_luaL_register", referenced from:
_luaopen_protobuf_c in pbc-lua-cc4638.o
"_lua_call", referenced from:
_push_value in pbc-lua-cc4638.o
"_lua_checkstack", referenced from:
__pattern_unpack in pbc-lua-cc4638.o
"_lua_createtable", referenced from:
__pattern_unpack in pbc-lua-cc4638.o
__decode in pbc-lua-cc4638.o
__gc in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
"_lua_insert", referenced from:
_decode_cb in pbc-lua-cc4638.o
"_lua_isstring", referenced from:
__rmessage_new in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
"_lua_isuserdata", referenced from:
__pattern_unpack in pbc-lua-cc4638.o
"_lua_newuserdata", referenced from:
__gc in pbc-lua-cc4638.o
"_lua_objlen", referenced from:
__pattern_pack in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
"_lua_pushboolean", referenced from:
__env_type in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
__decode in pbc-lua-cc4638.o
_push_value in pbc-lua-cc4638.o
"_lua_pushcclosure", referenced from:
__gc in pbc-lua-cc4638.o
"_lua_pushinteger", referenced from:
__env_type in pbc-lua-cc4638.o
__rmessage_integer in pbc-lua-cc4638.o
__rmessage_size in pbc-lua-cc4638.o
__wmessage_buffer in pbc-lua-cc4638.o
__pattern_size in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
__env_enum_id in pbc-lua-cc4638.o
...
"_lua_pushlightuserdata", referenced from:
__env_new in pbc-lua-cc4638.o
__rmessage_new in pbc-lua-cc4638.o
__rmessage_int32 in pbc-lua-cc4638.o
__rmessage_message in pbc-lua-cc4638.o
__wmessage_new in pbc-lua-cc4638.o
__wmessage_message in pbc-lua-cc4638.o
__wmessage_buffer in pbc-lua-cc4638.o
...
"_lua_pushlstring", referenced from:
__rmessage_int64 in pbc-lua-cc4638.o
__rmessage_string in pbc-lua-cc4638.o
__wmessage_buffer_string in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
__pattern_pack in pbc-lua-cc4638.o
_push_value in pbc-lua-cc4638.o
"_lua_pushnumber", referenced from:
__rmessage_int52 in pbc-lua-cc4638.o
__rmessage_uint52 in pbc-lua-cc4638.o
__rmessage_real in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
_push_value in pbc-lua-cc4638.o
"_lua_pushstring", referenced from:
__env_type in pbc-lua-cc4638.o
__last_error in pbc-lua-cc4638.o
_push_value in pbc-lua-cc4638.o
"_lua_pushvalue", referenced from:
__decode in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
_push_value in pbc-lua-cc4638.o
"_lua_rawgeti", referenced from:
__pattern_pack in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
"_lua_rawseti", referenced from:
__pattern_unpack in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
"_lua_setfield", referenced from:
__gc in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
"_lua_setmetatable", referenced from:
__gc in pbc-lua-cc4638.o
"_lua_settop", referenced from:
__env_type in pbc-lua-cc4638.o
__pattern_pack in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
"_lua_toboolean", referenced from:
__pattern_pack in pbc-lua-cc4638.o
"_lua_tointeger", referenced from:
__rmessage_string in pbc-lua-cc4638.o
__rmessage_message in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
__pattern_pack in pbc-lua-cc4638.o
"_lua_tolstring", referenced from:
__rmessage_new in pbc-lua-cc4638.o
__wmessage_int64 in pbc-lua-cc4638.o
__pattern_unpack in pbc-lua-cc4638.o
__pattern_pack in pbc-lua-cc4638.o
"_lua_touserdata", referenced from:
__env_register in pbc-lua-cc4638.o
__env_type in pbc-lua-cc4638.o
__rmessage_new in pbc-lua-cc4638.o
__rmessage_delete in pbc-lua-cc4638.o
__rmessage_integer in pbc-lua-cc4638.o
__rmessage_int32 in pbc-lua-cc4638.o
__rmessage_int64 in pbc-lua-cc4638.o
...
"_lua_type", referenced from:
__env_type in pbc-lua-cc4638.o
__wmessage_int32 in pbc-lua-cc4638.o
__wmessage_int64 in pbc-lua-cc4638.o
__pattern_pack in pbc-lua-cc4638.o
__decode in pbc-lua-cc4638.o
_decode_cb in pbc-lua-cc4638.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [protobuf.so] Error 1
···

@cloudwu
Copy link
Owner

cloudwu commented Aug 5, 2015

google How to Create Shared Objects under Mac OS X

@wbdu
Copy link
Author

wbdu commented Aug 6, 2015

Thks, 我依照google结果在编译参数中加了 -dynamiclib,依旧报错。

@wbdu wbdu closed this as completed Aug 6, 2015
@wbdu wbdu reopened this Aug 6, 2015
@wbdu
Copy link
Author

wbdu commented Aug 6, 2015

要在编译参数中加入 -undefined dynamic_lookup 才可以

@wbdu wbdu closed this as completed Aug 6, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants