[Asterisk-Users] static linking

Tzafrir Cohen tzafrir at cohens.org.il
Sun May 29 02:08:23 MST 2005


On Fri, May 27, 2005 at 06:47:40PM -0500, Benjamin West wrote:
> Has anyone tried or had success statically linking Asterisk?  I'd like
> to do this to deploy to smaller boxes that don't have the toolchain
> and libraries to build the thing.

You don't need all the toolchain on the target box just to deploy
Asterisk. Debian binary packages work just fine (even for the kernel
modules, at least the ones I build, and Xorcom Rapid, of course). 
Astlinux is another binary  distribution, and is intended for small systems. 

You just need to be careful enough with your build system.

Anyway, as Asterisk loads modules at runtime, I wouldn't expect your 
troubles to be over just by static linking.

> 
> I've tried using statifier (at sf.net) which claims to take a dynamic
> executable and transform it into a static executable. 

A nice tool, indeed. 

> It seemed to
> work on my box, but when I tried it on the target box it did this:
> [root at 0060ef21765a /]# asterisk 
> Illegal instruction

Maybe strace could give you a better idea at what's happening. Adding
some '-s'-s and some '-d' never harms anybody as well, in case you
managed to get to Asterisk's main().

> [root at 0060ef21765a /]# 
> 
> I've also tried messing with the Makefile.  Specifically I did this:
> #ASTLINK=-Wl,-E 
> #SOLINK=-shared -Xlinker -x
> ASTLINK=-Wl,-E 
> SOLINK=-static -Xlinker -x

Statifier still needs the same dinamically-linked binary, IIUC. It will
do that "statification" magic on its own. To quote the homepage:

| Files, created by statifier ("pseudo-static") combine disadvantages of
| both of them:
| 
|   * Huge - much bigger than statically linked
|   * Still use PIC code

-- 
Tzafrir Cohen         | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il |                           | a Mutt's  
tzafrir at cohens.org.il |                           |  best
ICQ# 16849755         |                           | friend



More information about the asterisk-users mailing list