[Freeswitch-dev] Linking C++ .so Into Custom Freeswitch Module

Ken Rice krice at freeswitch.org
Sun Sep 30 07:37:03 MSD 2012


just add them all on 1 line space seperated

Ken
Sent from my iPad

On Sep 29, 2012, at 9:46 PM, Jon Lederman <jon2718 at gmail.com> wrote:

> Hi Anthony,
> 
> I had a question about the LOCAL_LIBADD syntax.  I have several libraries I need to add.  
> When I tried:
> 
> LOCAL_LIBADD=path_to_lib1/lib1.a
> LOCAL_LIBADD+=path_to_lib2/lib2.a
> LOCAL_LIBADD+=path_to_lib3/lib3.a
> 
> However, this didn't seem to work.  Does the += syntax append libraries?  I was able to get around this problem by extracting the .a files and the combining them in a single .a file, which I was able to load into audio weaver.  What is the correct syntax to add multiple libraries in the makefile?
> 
> Thanks.
> 
> -Jon
> On Sep 28, 2012, at 9:26 AM, Anthony Minessale <anthony.minessale at gmail.com> wrote:
> 
>> if you want to do it that way then build a static version of your aw.so and use the .a in the LOCAL_LIBADD
>> 
>> if you want to do the .so it would have to be installed somewhere and in the LD_LIBRARY_PATH at runtime
>> 
>> On Fri, Sep 28, 2012 at 10:56 AM, Jon Lederman <jon2718 at gmail.com> wrote:
>> Hi,
>> 
>> Thanks for your reply.  The problem is that I'm not sure I'm linking the external libs correctly.  My module makefile is:
>> 
>> BASE=../../../..
>> LOCAL_LIBADD+=./lib/aw.so
>> include $(BASE)/build/modmake.rules
>> 
>> Shouldn't LOCAL_LIBADD be enough.  Or do I need additional statements in my makefile.  The aw.so defines the symbol in question yet I still receive the missing symbol message when I try to load the module.
>> 
>> Any help would be greatly appreciated.
>> 
>> Thanks in advance.
>> 
>> Jon
>> 
>> 
>> On Sep 28, 2012, at 11:27 AM, Anthony Minessale <anthony.minessale at gmail.com> wrote:
>> 
>>> to auto-load you also need modules.conf.xml modules.conf is only for building.
>>> 
>>> The module can't load because it's missing the symbol:
>>> 
>>> ZN10CAWETalker9ConfigureEPKc
>>> 
>>> So you need to link in any external libs you might be using into your .so
>>> 
>>> 
>>> On Fri, Sep 28, 2012 at 12:05 AM, Jon Lederman <jon2718 at gmail.com> wrote:
>>> Hi,
>>> 
>>> I am writing a custom module called mod_aw for freeswitch that uses a dynamic library called aw.so containing a c++ class.  I edited the makefile for my module to:
>>> 
>>> BASE=../../../..
>>> LOCAL_LIBADD+=./lib/aw.so
>>> include $(BASE)/build/modmake.rules
>>> 
>>> I am able to build the module and also modified modules.conf to include the new module.
>>> 
>>> When I start freeswitch, I don't see a message that the module was loaded.
>>> 
>>> When I type: reload mod_aw I receive the following error:
>>> 
>>> 2012-09-28 04:49:52.738493 [CRIT] switch_loadable_module.c:1310 Error Loading module /usr/local/freeswitch/mod/mod_aw.so
>>> **/usr/local/freeswitch/mod/mod_aw.so: undefined symbol: _ZN10CAWETalker9ConfigureEPKc**
>>> 
>>> -ERR unloading module [No such module!]
>>> +OK Reloading XML
>>> -ERR loading module [module load file routine returned an error]
>>> 
>>> I know the library works as I have tried it in another program outside of freeswitch.  I am not sure what I am doing wrong.  I am wondering whether I need to provide extern "C" linkage for the c++ library.  However, I only have the .h file and .so file for the library.  Or, do I need to add something to my Makefile.
>>> 
>>> Any help on how to configure this would be greatly appreciated.
>>> 
>>> Thank you in advance.
>>> 
>>> -Jon
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>> 
>>> 
>>> 
>>> 
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>> 
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org
>>> 
>>> 
>>> 
>>> -- 
>>> Anthony Minessale II
>>> 
>>> FreeSWITCH http://www.freeswitch.org/
>>> ClueCon http://www.cluecon.com/
>>> Twitter: http://twitter.com/FreeSWITCH_wire
>>> 
>>> AIM: anthm
>>> MSN:anthony_minessale at hotmail.com
>>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>>> IRC: irc.freenode.net #freeswitch
>>> 
>>> FreeSWITCH Developer Conference
>>> sip:888 at conference.freeswitch.org
>>> googletalk:conf+888 at conference.freeswitch.org
>>> pstn:+19193869900
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>> 
>>> 
>>> 
>>> 
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>> 
>>> FreeSWITCH-dev mailing list
>>> FreeSWITCH-dev at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>>> http://www.freeswitch.org
>> 
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> 
>> 
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>> 
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
>> 
>> 
>> 
>> 
>> -- 
>> Anthony Minessale II
>> 
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>> 
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>> 
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>> 
>> 
>> 
>> 
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>> 
>> FreeSWITCH-dev mailing list
>> FreeSWITCH-dev at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>> http://www.freeswitch.org
> 
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
> 
> 
> 
> 
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
> 
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20120929/3707b280/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list