maybe your user does not have permissions to read and write the target install dir <div>try to chown -R to your user on all of /usr/local/freeswitch</div><div><br></div><div>you might want to try things the other way around and embedd your app in FS rather than embed FS in your app.</div>
<div><br><br><div class="gmail_quote">On Tue, Nov 22, 2011 at 10:20 AM, xl127 <span dir="ltr">&lt;<a href="mailto:x.liu@hw.ac.uk">x.liu@hw.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    If I switch to root user I can successfully run my embedded FS app:
    FS_Embed.<br>
    but it will fails if I run it as non-root user.<br>
    <br>
    One thing I can think of to do is re-install FS as non-root.<br>
    I tried but it failed to access
    /usr/lib/python2.7/site-packages/freeswitch.py due to the
    permissions.<div><div></div><div class="h5"><br>
    <br>
    <br>
    On 22/11/11 16:08, Anthony Minessale wrote:
    <blockquote type="cite">i know you needed apr, not sure, maybe try strace or
      gdb
      <div><br>
        <br>
        <div class="gmail_quote">On Tue, Nov 22, 2011 at 6:36 AM, xl127
          <span dir="ltr">&lt;<a href="mailto:x.liu@hw.ac.uk" target="_blank">x.liu@hw.ac.uk</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div text="#000000" bgcolor="#FFFFFF"> Thanks for the
              advice!<br>
              <br>
              I tried it but still got the same error. <br>
              <br>
              I added the #include &lt;apr_general.h&gt; and found it
              from /usr/local/sr/freeswitch/libs/apr/include<br>
              rather than from the installed directory
              /usr/local/freeswitch. Hope it is the right one.<br>
              <br>
              any more clues?
              <div>
                <div><br>
                  <br>
                  <br>
                  On 22/11/11 01:38, Anthony Minessale wrote:
                  <blockquote type="cite">try 
                    <div><br>
                    </div>
                    <div>
                      <div>    if (apr_initialize() !=
                        SWITCH_STATUS_SUCCESS) {</div>
                      <div>        fprintf(stderr, &quot;FATAL ERROR! Could
                        not initialize APR\n&quot;);</div>
                      <div>        return 255;</div>
                      <div>    }</div>
                      <div> <br>
                      </div>
                      <div>early on in main()</div>
                      <div><br>
                      </div>
                      <br>
                      <div class="gmail_quote">On Mon, Nov 21, 2011 at
                        1:12 PM, xl127 <span dir="ltr">&lt;<a href="mailto:x.liu@hw.ac.uk" target="_blank">x.liu@hw.ac.uk</a>&gt;</span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Hello,<br>
                          <br>
                          Following the instructions in<br>
                          <a href="http://wiki.freeswitch.org/wiki/Embedding_FreeSWITCH" target="_blank">http://wiki.freeswitch.org/wiki/Embedding_FreeSWITCH</a><br>
                          I am trying to use Embedded FreeSwitch.<br>
                          <br>
                          I installed FS in Fedora linux as a root user
                          in /usr/local/freeswitch.<br>
                          Now as non-root user,<br>
                          I compiled following codes:<br>
                          <br>
                          #include &lt;switch.h&gt;<br>
                          int main(int argc, char** argv)<br>
                          {<br>
                              switch_core_flag_t flags = SCF_USE_SQL;<br>
                              bool console = true;<br>
                              const char *err = NULL;<br>
                              switch_core_set_globals();<br>
                              switch_core_init_and_modload(flags,
                          console ? SWITCH_TRUE :<br>
                          SWITCH_FALSE, &amp;err);<br>
                              switch_core_runtime_loop(!console);<br>
                              return 0;<br>
                          }<br>
                          <br>
                          And copy the executable and conf, mod,
                          contents of lib of the installed<br>
                          FS to my $MyWorkingDir.<br>
                          <br>
                          My directory structure looks like:<br>
                             MyWorkingDir--bin/  (contains my
                          executable: FS_Embed)<br>
                                                  --conf/<br>
                                                  --mod/<br>
                                                  --lib/<br>
                                                  --grammars<br>
                                                  --sounds<br>
                                                  --scripts<br>
                                                  --log<br>
                          (I also tried to copy the contents of lib
                          directory into MyWorkingDir)<br>
                          <br>
                          When I run my embedded FS: ./FS_Embed, I got
                          error<br>
                          <br>
                          2011-11-21 18:46:26.606783 [INFO]
                          switch_event.c:631 Activate Eventing<br>
                          Engine.<br>
                          2011-11-21 18:46:26.617941 [DEBUG]
                          switch_event.c:610 Create event<br>
                          dispatch thread 0<br>
                          FS_Embed: src/switch_xml.c:2225:
                          switch_xml_open_cfg: Assertion<br>
                          `MAIN_XML_ROOT != ((void *)0)&#39; failed.<br>
                          Aborted (core dumped)<br>
                          <br>
                          and occasionally on another run, I got error:<br>
                          <br>
                          2011-11-21 16:56:51.756040 [INFO]
                          switch_event.c:631 Activate Eventing<br>
                          Engine.<br>
                          2011-11-21 16:56:51.767198 [DEBUG]
                          switch_event.c:610 Create event<br>
                          dispatch thread 0<br>
                          Segmentation fault (core dumped)<br>
                          <br>
                          It looks like there are some things wrong with
                          my Environment Setup for<br>
                          Embedded FS,<br>
                          but after a while of checking/trying/googling
                          I couldn&#39;t find what&#39;s wrong.<br>
                          <br>
                          Any advice please?<br>
                          <br>
                          Many thanks!<br>
                          Xing<br>
                          <br>
                          <br>
                          <br>
                          --<br>
                          Heriot-Watt University is a Scottish charity<br>
                          registered under charity number SC000278.<br>
                          <br>
                          Heriot-Watt University is the Sunday Times<br>
                          Scottish University of the Year 2011-2012<br>
                          <br>
                          <br>
                          <br>
_________________________________________________________________________<br>
                          Professional FreeSWITCH Consulting Services:<br>
                          <a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
                          <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
                          <br>
                          FreeSWITCH-powered IP PBX: The CudaTel
                          Communication Server<br>
                          <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
                          <br>
                          Official FreeSWITCH Sites<br>
                          <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
                          <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
                          <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
                          <br>
                          FreeSWITCH-users mailing list<br>
                          <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
                          <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
                          UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
                          <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <div><br>
                      </div>
                      -- <br>
                      Anthony Minessale II<br>
                      <br>
                      FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
                      ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
                      Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
                      <br>
                      AIM: anthm<br>
                      <a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
                      GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
                      IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a>
                      #freeswitch<br>
                      <br>
                      FreeSWITCH Developer Conference<br>
                      <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
                      <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
                      pstn:<a href="tel:%2B19193869900" value="+19193869900" target="_blank">+19193869900</a><br>
                    </div>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
                  </blockquote>
                  <br>
                  <br>
                </div>
              </div>
              <hr>
              <br>
              <img src="cid:part1.09030104.01070700@hw.ac.uk" alt="MailScanner Signature HW" align="left">
              <font face="arial,helvetica">
                  <b>Heriot-Watt University is the Sunday Times
                  <div><br>
                      Scottish University of the Year 2011-2012</div>
                </b>
              </font>
              <br>
              <div><br>
                <font face="arial,helvetica" size="-1">
                    Heriot-Watt University is a Scottish charity<br>
                    registered under charity number SC000278.
                  <br>
                </font>
              </div>
            </div>
            <br>
_________________________________________________________________________<br>
            Professional FreeSWITCH Consulting Services:<br>
            <a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
            <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
            <br>
            FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
            <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
            <br>
            Official FreeSWITCH Sites<br>
            <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
            <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
            <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
            <br>
            FreeSWITCH-users mailing list<br>
            <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
            <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
            UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
            <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        Anthony Minessale II<br>
        <br>
        FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
        ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
        Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
        <br>
        AIM: anthm<br>
        <a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
        GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
        IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a>
        #freeswitch<br>
        <br>
        FreeSWITCH Developer Conference<br>
        <a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
        <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
        pstn:<a href="tel:%2B19193869900" value="+19193869900" target="_blank">+19193869900</a><br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
    </blockquote>
    <br>
  <br>
<hr>
<br>
<img src="cid:hw_uni_of_year.jpg" align="left" alt="MailScanner Signature HW">
<font face="arial,helvetica">
  <b>Heriot-Watt University is the Sunday Times<br> 
  Scottish University of the Year 2011-2012</b>
</font>
<br><br>
<font face="arial,helvetica" size="-1">
  Heriot-Watt University is a Scottish charity<br>
  registered under charity number SC000278.
<br>
</font>

</div></div></div>

<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>
</div>