ayylmao
ayylmao

Reputation: 13

Luabind Undefined Symbols/ Luabind::scope::scope

I have just started working with Luabind, and have attempted to run the Hello World test specified at http://www.rasterbar.com/products/luabind/docs.html#calling-lua-functions. However, this provides an undefined symbol error when attempted to compile.

Undefined symbols for architecture x86_64:
  "luabind::scope::scope(std::__1::auto_ptr<luabind::detail::registration>)", referenced from:
      luabind::scope luabind::def<void (*)(), luabind::detail::null_type>(char const*, void (*)(), luabind::detail::null_type const&) in TestClass.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Other functions such as luabind::open and luabind::call_function work correctly.

I installed both luabind and lua 5.1 through homebrew on osx.

Upvotes: 1

Views: 261

Answers (1)

Montdidier
Montdidier

Reputation: 1210

It looks to me like you are compiling your program against libc++ and trying to link to a luabind library that was compiled against the stdlibc++ library.

The clue is std::__1::auto_ptr. This __1 inline namespace is used by libc++ to differentiate it's ABI from stdlibc++

Thus if

luabind::scope::scope(std::__1::auto_ptr<luabind::detail::registration>)

Cannot be found it is likely because libluabind doesn't have it. Dumping it's exported symbols you might find it has

luabind::scope::scope(std::auto_ptr<luabind::detail::registration>)

Instead.

If I am right, simply recompile libluabind targeting libc++ and you should find it works with your test program.

Upvotes: 0

Related Questions