login | register
Tue 02 of Dec, 2008 [01:55 UTC]

voip-info.org

Asterisk Build Notes for Solaris

Created by: benjk,Last modification on Fri 30 of Jul, 2004 [06:57 UTC] by oej
Logan submitted these notes ...

I have Asterisk 1.0-RC1 running under Solaris 10 (s10_60) using a
Sipura SPA-3000 for local FXS and FXO ports. I built the binaries with
gcc 3.4.0 on a Solaris 9 box. I initially ran it on the Solaris 9 box
then moved it to the Solaris 10 box. Both boxes are multiprocessor sun
boxes. For my usage using only network based channels Asterisk
appears to run fine under Solaris.

I had to make a large number of minor changes to get it to build. I'll
look into submitting a patch to the developers. Until then here is a
list of the changes.

include/asterisk/lock.h:
added (very important to get properly
initialized recursive mutexes.)
#define AST_MUTEX_INIT_W_CONSTRUCTORS

utils.c:
arguments for gethostbyname_r are different.
res = gethostbyname_r(host, &hp->hp, hp->buf, sizeof(hp->buf), &herrno);
if (!res || !hp->hp.h_addr_list || !hp->hp.h_addr_list0)

apps/app_qcall.c:
replaced flock calls with fcntl calls. like
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = 0;
lock.l_len = 0;
if (fcntl(fileno(fp), F_SETLK, &lock) == -1)

acl.c:
added #include and removed the static
initializer for __ourip (os version dependent.)

asterisk.c:
replaced local variable "sun" with "sunAddr" to avoid conflicting macro definition.

logger.c:
the syslog facility enumeration is different under solaris.
I punted and hardwired LOG_LOCAL0 for my use.

stdtime/localtime.c:
added
#define _POSIX_PTHREAD_SEMANTICS
#undef TM_ZONE
#undef TM_GMTOFF

channels/chan_mgcp.c:
replaced INADDR_NONE with (in_addr_t)(-1)

channels/chan_agent.c:
removed sched_yield() calls. they shouldn't be necessary anyway.

channels/chan_modem.c:
cfmakeraw and cfsetspeed don't exist under solaris. Someone should replace them with the appropriate calls to set the speed but I'm not using this channel so I just commented them out for my use.

replaced various references to u_int*_t with uint*_t.
They are both used but only uint*_t is defined under Solaris.

replaced various references to AF_LOCAL with AF_UNIX

defined BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN

removed #include from various source files

added an implementation of strsep which doesn't exist under solaris.
Initially considered replacing with strtok_r but there are too many occurrences.

added sun to the mac rule to note build all the /dev/dsp based stuff. intercom for example.

added -D_REENTRANT for sun.

added sun libs -lsocket -lresolv -ldl -lpthread -lthread

for sun switched -lncurses to -lcurses

changed sun ASTLINK to just -Wl

changed GREP to use /usr/xpg4/bin/grep

avoided -march flags in various build files

changed mkdep to use bash:
first line #!/usr/bin/bash

I'm probably forgetting some changes but that should be most of them.

logan
~/np~



Comments

Comments Filter
222

333Re: Can't get it to work :-(

by , Friday 17 of September, 2004 [19:20:00 UTC]
> it looks like the bus error is caused by unaligned data writes in rtp.c

Correct.
I had the same problem. After fixing the non-aligned accesses in rtp.c (32 of them)
and in iax2-parser.c (14 of them), I am able to send and receive both sip and
iax calls using a grandstream-100, xten-lite, an iax client (tkphone) and a cisco
sip gateway.

adding -Wcast-align to gcc makes the alignment thingies it easier to find.
.
Stil lots to do though.
Stephen
222

333Can't get it to work :-(

by , Wednesday 18 of August, 2004 [07:57:44 UTC]
I've followed your instructions, and (finally) got asterisk to build. One key thing you missed is that you also need an implementation of strtoq (and solaris quad_t seems to be different to what asterisk expects, if I understand it correctly, so I just replaced them all with uint64_t)

However, now I've got it compiled, it's core dumping (bus error) when I try to actually use it. I've got a simple config which allows connection from SIP, and has a single extension which calls VoicemailMain.

It looks like the bus error is caused by unaligned data writes in rtp.c

gdb show the fault is at:

  1. 0 0x518b8 in ast_rtp_raw_write (rtp=0xdc380, f=0xea28c, codec=3)
   at rtp.c:1110

...which is this line:

       rtpheader0 = htonl((2 seqno++) | (mark
data == eeb25, rtpheader == eeb19, hdrlen = 12

which points at rtpheader not being aligned, and thus (I believe) why it bus errored when it tried to write an int to it.

Did you manage to fix this?

Simon
(simon@slimey.org)