[Freeswitch-users] Cross compiling freeswitch for raspberry pi

Dušan Dragić dragic.dusan at gmail.com
Thu Jan 2 00:23:19 MSK 2014


I guess you could call it an academic exercise, on some level it was.
I wanted to see what would it take to cross compile freeswitch, since
information about this topic (in regard to freeswitch) is scarce. As
it turned out, there were a few obstacles on the way, but I used it as
an opportunity to get more familiar with the build system.

The other part of this was that I just wanted faster compiles.
And although cross compiling is much, much faster (just as fast as
compiling natively for the build system itself), in the case of RPi,
BBB and similar arm boards I would agree that it's probably not worth
going this route, but it very much depends on your use case.
It should also be mentioned that on many embedded systems native
building is simply not possible (due to constrained resources).

On 1 January 2014 20:29, Peter Steinbach <lists at telefaks.de> wrote:
> Its already some time ago (March 2013) when we built Freeswitch with a fresh
> compile from git on Rapsberry Pi.
>
> But it just worked right of of the box, after having all dependend libraries
> installed on Raspbian. It takes a couple of hours though until ./configure
> finshed and to see that a library was missing. So every time it took some
> hours again to solve the next problem with missing dependencies. But finally
> it worked.
> And I cannot guarantee that every module is working, we just used just the
> minimum of modules to make it working as a SBC and to register phones.
>
> I think it makes sense to write down all the needed installation steps for
> compiling Freeswitch on RPi in a seperate wiki chapter.
> I did some basic steps here:
> https://wiki.freeswitch.org/wiki/Raspberry_PI-specific_documentation#Installation_from_GIT_.28Raspbian.29
>
>
> Best regards
> Peter
>
>
>
>
> On 01/01/14 19:08, Ken Rice wrote:
>
> I think the real reason people want to cross compile it as they see it as
> being faster, however, I have found its more of a pain then its really
> worth... Even Raspbian doesn’t cross compile, they use binary compatible
> hardware (they were using the Freescale i.MX5 platform, however not sure if
> they still are as about 4 or 5 months ago Plugwash commented on how it was
> getting a bit long in the tooth, and i.MX6 hardware is shipping now)
>
> As far as building on The Rpi under raspbian you just follow the debian
> instructions
>
> K
>
>
> On 1/1/14 12:01 PM, "Bob Hartwig" <bobjects at gmail.com> wrote:
>
> 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:
>
> http://www.bobjectsinc.com/tinycomputers/raspberry-pi-vs-beaglebone-black-building-freeswitch/
>
> It takes awhile, but doesn't require any head-scratching.
>
>     Bob
>
>
>
> On Wed, Jan 1, 2014 at 11:37 AM, Dušan Dragić <dragic.dusan at gmail.com>
> wrote:
>
> Happy New Year Everyone! May all your wishes come true!
>
>
> Finally had some time to get back at this.
> After my last message I simply built freeswitch using qemu-arm-static
> since I needed it running on RPi.
> That worked just fine, except for some mod_spandsp trouble (more on that
> later).
>
> Now I took another shot at cross compiling.
> First, I looked at config.cache differences between cross compile and
> native, and there where quite a few.
> But most where because apr disables large file support when being
> cross compiled. There where also some thread related but none that
> made any difference, freeswitch still segfaulted in the same way.
>
> Since this was on Fedora 19 64-bit, I decided to try on a different
> build platform, namely Debian 7.3 64-bit.
> While running make on debian I ran into FS-5956 (infinite loop on
> build), but thankfully Seven Du's fix-loop-on-mac-2.diff patch fixed
> the problem.
>
> After it was finally built I started freeswitch on RPi and what do you
> know, it actually runs and works!!
>
> The build steps are the same as outlined in my first post (the env
> setup script was the same, only paths and build gcc's triplet were
> changed).
>
> If anyone wants to try this (using --sysroot), you will probably need
> the patch from FS-6016 to fix esl makefile (or something along those
> lines). Also you may need the patch from FS-6015, but that can be
> sidestepped by using "export config_TARGET_LIBS=-lpthread" (Note:
> debian's gcc is built with "--with-sysroot=/" so sqlite configure will
> probably not fail to detect libpthread, but it will be testing for the
> build system library not the host (raspbian; rpi sysroot) one).
>
> Minor annoyance: freeswitch version string is missing the git revision
> and date since ./build/print_git_revision got built for arm and didn't
> run on the build system (x86). This is a similar problem as with
> gennmtab that I mentioned before.
>
> As mentioned earlier, spandsp doesn't work for me on rpi, but this
> isn't related to cross-compiling, I'm also having this problem with
> native compiled freeswitch (both master and stable). It hogs the cpu
> during module loading (while adding tone descriptors), but also
> elsewhere (for example sending fax with txfax). I'll start a new
> thread about this issue.
>
>
> Well, there you have it, cross-compiled freeswitch... sorry about the
> long, blog like post :)
>
> P.S. Kristian, thanks for the openwrt link. Even though I didn't go
> that route (for now), it's useful to see how others have dealt with
> some of these problems.
>
> On 4 December 2013 03:12, Kristian Kielhofner <kris at kriskinc.com> wrote:
>> Your best bet to cross compile for Raspberry Pi (or anything, really)
>> is to use OpenWRT:
>>
>> http://wiki.openwrt.org/toh/raspberry_pi
>>
>> with the latest OpenWRT telephony code:
>>
>> http://git.nanl.de/?p=openwrt/telephony.git;a=summary
>>
>> If you give it a shot let us know how it goes!
>>
>> On Tue, Dec 3, 2013 at 3:21 PM, Dušan Dragić <dragic.dusan at gmail.com>
>> wrote:
>>> Hi all,
>>>
>>> This weekend I tried my luck at cross-compiling freeswitch for
>>> raspberry pi (armv6). After a few bumps along the way (opened jiras
>>> for those) I managed to build it, but  when running freeswitch on the
>>> target system it segfaults during startup.
>>>
>>> I'm building on Fedora 19 x86_64 using the prebuilt toolchain from
>>> https://github.com/raspberrypi/tools (I can build a toolchain from
>>> source if anyone thinks it might be better). Raspbian debootstrap
>>> created base system is used as sysroot (also tried loop mounted
>>> raspbian image as sysroot).
>>>
>>> My simple build environment setup script:
>>> http://pastebin.freeswitch.org/21698
>>>
>>> The build process (source the script, configure and compile):
>>> ./bootstrap.sh
>>> . ~/fs-cc-env.sh
>>> ./configure --build=x86_64-redhat-linux --host=arm-linux-gnueabihf
>>> --with-sysroot=$SYSROOT
>>> make
>>>
>>> make install didn't work (I guess it's kinda expected, didn't really
>>> look into it) so I just copied the binaries, libraries and modules to
>>> rpi.
>>> Also mod_spidermonkey and mod_xml_rpc were disabled. Didn't even try
>>> to build mod_spidermonkey and mod_xml_rpc failed to build (well it
>>> builds but makefile tries to run
>>> libs/xmlrpc-c/lib/expat/gennmtab/gennmtab which was compiled for arm
>>> and should have been x86, probably should create jira for this as
>>> well).
>>>
>>> Console log when FS is started:
>>> http://pastebin.freeswitch.org/21699
>>>
>>> and backtrace:
>>> http://pastebin.freeswitch.org/21700
>>>
>>> Is my build environment sane? What am I missing, any hints? Has anyone
>>> successfully cross-compiled FS for raspberry pi?
>>>
>>> Thanks,
>>> --
>>> Dušan Dragić
>>>
>>> _________________________________________________________________________
>>> 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-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>
>>
>>
>> --
>> Kristian Kielhofner
>>
>> _________________________________________________________________________
>> 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-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>
>
>
> --
> Dušan Dragić
>
> _________________________________________________________________________
> 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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> 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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
> --
> Ken
> http://www.FreeSWITCH.org
> http://www.ClueCon.com
> http://www.OSTAG.org
> irc.freenode.net #freeswitch
> Twitter: @FreeSWITCH
>
>
>
> _________________________________________________________________________
> 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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
>
> --
> With kind regards
> Peter Steinbach
>
> Telefaks Services GmbH
> mailto:lists (att) telefaks.de
> Internet: www.telefaks.de
>
>
> _________________________________________________________________________
> 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-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



-- 
Dušan Dragić



Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list