Re: Trouble running the hello world application

Tom McCubbin <[email protected]> Fri, 14 Sep 2012 10:01:27 -0400
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <CANDPXWHdaX81UJEoU1A3ozRAKb6+57KXLpby03dL1YtOxsKPJQ@mail.gmail.com>
that is typeinfo for luabind::detail::registration which i'd bet is in the
luabind library.

if you look at your link command below you will see you are not linking the
luabind itself, hence the undefined symbol

add a -lluabind and all should be well.  you may need also to add a
-L<where ever the lib is path> so the linker can find it.

-tom

ps - you don't need to add the .so when requiring the file, and you might
drop the 'lib' prefix of the library to make it look more natural in lua.
then you could just right

require('hellobind')



On Fri, Sep 14, 2012 at 9:37 AM, Robert Vasek <[email protected]> wrote:

> On Thu, 13 Sep 2012, Tom McCubbin wrote:
>
> > In linux it uses the normal lua search path.  if the library loaded has
> > dependencies it will use the path in $LD_LIBRARY_PATH to search for them,
> > or the rpath embedded in the library loaded.
> >
> > On Thu, Sep 13, 2012 at 9:03 AM, Willi Schinmeyer <[email protected]
> >wrote:
> >
> > > > Can I use require to load dynamic libraries?
> > > Works on windows anyway. Not sure which directories are searched on
> > > Linux, but it should work somehow.
> > >
> > >
> > >
> ------------------------------------------------------------------------------
> > > Live Security Virtual Conference
> > > Exclusive live event will cover all the ways today's security and
> > > threat landscape has changed and how IT managers can respond.
> Discussions
> > > will include endpoint security, mobile security and the latest in
> malware
> > > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> > > _______________________________________________
> > > luabind-user mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/luabind-user
> > >
> >
>
> Yeah when I type:
> require("libhellobind.so")
>
> apparently it can find the lib (which is located in the same dir as the
> .lua file), however it gives me this error with an undefined symbol:
> $ lua test.lua
> lua: error loading module 'libhellobind.so' from file
> './libhellobind.so':
>         ./libhellobind.so: undefined symbol:
> _ZTIN7luabind6detail12registrationE
> stack traceback:
>         [C]: ?
>         [C]: in function 'require'
>         test.lua:6: in main chunk
>         [C]: ?
>
> So I may be creating the shared library somehow wrong.
> $ g++ hellobind.cpp -I/usr/include/lua5.1/ -c -fPIC
> $ g++ -shared -Wl,-soname,libhellobind.so.0 -o \
> libhellobind.so.0.0 hellobind.o
>
> test.lua:
>     1 require("libhellobind.so")
>
> And after running the lua file, the mentioned error occurs.
>
> I've also found this:
> http://www.gamedev.net/topic/624251-luabind-inside-a-shared-library/
> "// int luaopen_[libname] is the entry point"
> no luck with that either, still the same error.
>
> Thanks for all the respones so far.
>
>
> ------------------------------------------------------------------------------
> Got visibility?
> Most devs has no idea what their production app looks like.
> Find out how fast your code is with AppDynamics Lite.
> http://ad.doubleclick.net/clk;262219671;13503038;y?
> http://info.appdynamics.com/FreeJavaPerformanceDownload.html
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user
>

------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html

_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user