i know you needed apr, not sure, maybe try strace or gdb


On Tue, Nov 22, 2011 at 6:36 AM, xl127 <x.liu@hw.ac.uk> wrote:
Thanks for the advice!

I tried it but still got the same error.

I added the #include <apr_general.h> and found it from /usr/local/sr/freeswitch/libs/apr/include
rather than from the installed directory /usr/local/freeswitch. Hope it is the right one.

any more clues?



On 22/11/11 01:38, Anthony Minessale wrote:
try 

    if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
        fprintf(stderr, "FATAL ERROR! Could not initialize APR\n");
        return 255;
    }

early on in main()


On Mon, Nov 21, 2011 at 1:12 PM, xl127 <x.liu@hw.ac.uk> wrote:
Hello,

Following the instructions in
http://wiki.freeswitch.org/wiki/Embedding_FreeSWITCH
I am trying to use Embedded FreeSwitch.

I installed FS in Fedora linux as a root user in /usr/local/freeswitch.
Now as non-root user,
I compiled following codes:

#include <switch.h>
int main(int argc, char** argv)
{
    switch_core_flag_t flags = SCF_USE_SQL;
    bool console = true;
    const char *err = NULL;
    switch_core_set_globals();
    switch_core_init_and_modload(flags, console ? SWITCH_TRUE :
SWITCH_FALSE, &err);
    switch_core_runtime_loop(!console);
    return 0;
}

And copy the executable and conf, mod, contents of lib of the installed
FS to my $MyWorkingDir.

My directory structure looks like:
   MyWorkingDir--bin/  (contains my executable: FS_Embed)
                        --conf/
                        --mod/
                        --lib/
                        --grammars
                        --sounds
                        --scripts
                        --log
(I also tried to copy the contents of lib directory into MyWorkingDir)

When I run my embedded FS: ./FS_Embed, I got error

2011-11-21 18:46:26.606783 [INFO] switch_event.c:631 Activate Eventing
Engine.
2011-11-21 18:46:26.617941 [DEBUG] switch_event.c:610 Create event
dispatch thread 0
FS_Embed: src/switch_xml.c:2225: switch_xml_open_cfg: Assertion
`MAIN_XML_ROOT != ((void *)0)' failed.
Aborted (core dumped)

and occasionally on another run, I got error:

2011-11-21 16:56:51.756040 [INFO] switch_event.c:631 Activate Eventing
Engine.
2011-11-21 16:56:51.767198 [DEBUG] switch_event.c:610 Create event
dispatch thread 0
Segmentation fault (core dumped)

It looks like there are some things wrong with my Environment Setup for
Embedded FS,
but after a while of checking/trying/googling I couldn't find what's wrong.

Any advice please?

Many thanks!
Xing



--
Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

Heriot-Watt University is the Sunday Times
Scottish University of the Year 2011-2012



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
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@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




MailScanner Signature HW   Heriot-Watt University is the Sunday Times

  Scottish University of the Year 2011-2012


  Heriot-Watt University is a Scottish charity
  registered under charity number SC000278.

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
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@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900