<div dir="ltr">Is cross-compiling an academic exercise? If not, why not just natively build it? Natively building Asterisk or FreeSWITCH is as straightforward on the Raspberry Pi as it is on more mainstream platforms. Here's how I do it:<div>
<br></div><div><a href="http://www.bobjectsinc.com/tinycomputers/raspberry-pi-vs-beaglebone-black-building-freeswitch/">http://www.bobjectsinc.com/tinycomputers/raspberry-pi-vs-beaglebone-black-building-freeswitch/</a><br>
</div><div><br></div><div>It takes awhile, but doesn't require any head-scratching.</div><div><br></div><div> Bob</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 1, 2014 at 11:37 AM, Dušan Dragić <span dir="ltr"><<a href="mailto:dragic.dusan@gmail.com" target="_blank">dragic.dusan@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Happy New Year Everyone! May all your wishes come true!<br>
<br>
<br>
Finally had some time to get back at this.<br>
After my last message I simply built freeswitch using qemu-arm-static<br>
since I needed it running on RPi.<br>
That worked just fine, except for some mod_spandsp trouble (more on that later).<br>
<br>
Now I took another shot at cross compiling.<br>
First, I looked at config.cache differences between cross compile and<br>
native, and there where quite a few.<br>
But most where because apr disables large file support when being<br>
cross compiled. There where also some thread related but none that<br>
made any difference, freeswitch still segfaulted in the same way.<br>
<br>
Since this was on Fedora 19 64-bit, I decided to try on a different<br>
build platform, namely Debian 7.3 64-bit.<br>
While running make on debian I ran into FS-5956 (infinite loop on<br>
build), but thankfully Seven Du's fix-loop-on-mac-2.diff patch fixed<br>
the problem.<br>
<br>
After it was finally built I started freeswitch on RPi and what do you<br>
know, it actually runs and works!!<br>
<br>
The build steps are the same as outlined in my first post (the env<br>
setup script was the same, only paths and build gcc's triplet were<br>
changed).<br>
<br>
If anyone wants to try this (using --sysroot), you will probably need<br>
the patch from FS-6016 to fix esl makefile (or something along those<br>
lines). Also you may need the patch from FS-6015, but that can be<br>
sidestepped by using "export config_TARGET_LIBS=-lpthread" (Note:<br>
debian's gcc is built with "--with-sysroot=/" so sqlite configure will<br>
probably not fail to detect libpthread, but it will be testing for the<br>
build system library not the host (raspbian; rpi sysroot) one).<br>
<br>
Minor annoyance: freeswitch version string is missing the git revision<br>
and date since ./build/print_git_revision got built for arm and didn't<br>
run on the build system (x86). This is a similar problem as with<br>
gennmtab that I mentioned before.<br>
<br>
As mentioned earlier, spandsp doesn't work for me on rpi, but this<br>
isn't related to cross-compiling, I'm also having this problem with<br>
native compiled freeswitch (both master and stable). It hogs the cpu<br>
during module loading (while adding tone descriptors), but also<br>
elsewhere (for example sending fax with txfax). I'll start a new<br>
thread about this issue.<br>
<br>
<br>
Well, there you have it, cross-compiled freeswitch... sorry about the<br>
long, blog like post :)<br>
<br>
P.S. Kristian, thanks for the openwrt link. Even though I didn't go<br>
that route (for now), it's useful to see how others have dealt with<br>
some of these problems.<br>
<div class="HOEnZb"><div class="h5"><br>
On 4 December 2013 03:12, Kristian Kielhofner <<a href="mailto:kris@kriskinc.com">kris@kriskinc.com</a>> wrote:<br>
> Your best bet to cross compile for Raspberry Pi (or anything, really)<br>
> is to use OpenWRT:<br>
><br>
> <a href="http://wiki.openwrt.org/toh/raspberry_pi" target="_blank">http://wiki.openwrt.org/toh/raspberry_pi</a><br>
><br>
> with the latest OpenWRT telephony code:<br>
><br>
> <a href="http://git.nanl.de/?p=openwrt/telephony.git;a=summary" target="_blank">http://git.nanl.de/?p=openwrt/telephony.git;a=summary</a><br>
><br>
> If you give it a shot let us know how it goes!<br>
><br>
> On Tue, Dec 3, 2013 at 3:21 PM, Dušan Dragić <<a href="mailto:dragic.dusan@gmail.com">dragic.dusan@gmail.com</a>> wrote:<br>
>> Hi all,<br>
>><br>
>> This weekend I tried my luck at cross-compiling freeswitch for<br>
>> raspberry pi (armv6). After a few bumps along the way (opened jiras<br>
>> for those) I managed to build it, but when running freeswitch on the<br>
>> target system it segfaults during startup.<br>
>><br>
>> I'm building on Fedora 19 x86_64 using the prebuilt toolchain from<br>
>> <a href="https://github.com/raspberrypi/tools" target="_blank">https://github.com/raspberrypi/tools</a> (I can build a toolchain from<br>
>> source if anyone thinks it might be better). Raspbian debootstrap<br>
>> created base system is used as sysroot (also tried loop mounted<br>
>> raspbian image as sysroot).<br>
>><br>
>> My simple build environment setup script:<br>
>> <a href="http://pastebin.freeswitch.org/21698" target="_blank">http://pastebin.freeswitch.org/21698</a><br>
>><br>
>> The build process (source the script, configure and compile):<br>
>> ./bootstrap.sh<br>
>> . ~/fs-cc-env.sh<br>
>> ./configure --build=x86_64-redhat-linux --host=arm-linux-gnueabihf<br>
>> --with-sysroot=$SYSROOT<br>
>> make<br>
>><br>
>> make install didn't work (I guess it's kinda expected, didn't really<br>
>> look into it) so I just copied the binaries, libraries and modules to<br>
>> rpi.<br>
>> Also mod_spidermonkey and mod_xml_rpc were disabled. Didn't even try<br>
>> to build mod_spidermonkey and mod_xml_rpc failed to build (well it<br>
>> builds but makefile tries to run<br>
>> libs/xmlrpc-c/lib/expat/gennmtab/gennmtab which was compiled for arm<br>
>> and should have been x86, probably should create jira for this as<br>
>> well).<br>
>><br>
>> Console log when FS is started:<br>
>> <a href="http://pastebin.freeswitch.org/21699" target="_blank">http://pastebin.freeswitch.org/21699</a><br>
>><br>
>> and backtrace:<br>
>> <a href="http://pastebin.freeswitch.org/21700" target="_blank">http://pastebin.freeswitch.org/21700</a><br>
>><br>
>> Is my build environment sane? What am I missing, any hints? Has anyone<br>
>> successfully cross-compiled FS for raspberry pi?<br>
>><br>
>> Thanks,<br>
>> --<br>
>> Dušan Dragić<br>
>><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>
><br>
><br>
> --<br>
> Kristian Kielhofner<br>
><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>
<br>
<br>
--<br>
Dušan Dragić<br>
<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>
</div></div></blockquote></div><br></div>