[Home]

Summary:ASTERISK-12541: [Solaris] Build fails with new files added in asterisk 1.2.28.1 and above
Reporter:Bruce McAlister (asgaroth)Labels:
Date Opened:2008-08-08 07:37:46Date Closed:2008-08-09 10:19:28
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When trying to build any asterisk version greater than or equal to 1.2.28.1 the compile fails with the following error:

gcc  -pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -g3  -Iinclude -I../include -Iinclude/solaris-compat -I/usr/sfw/include -I/usr/xpg4/include -D_REENTRANT -D_GNU_SOURCE  -O6  -Wcast-align -DSOLARIS         -fomit-frame-pointer    -c -o astobj2.o astobj2.c
In file included from astobj2.c:26:
include/asterisk/astobj2.h:333: warning: type defaults to `int' in declaration of `uint'
include/asterisk/astobj2.h:333: error: syntax error before "n_buckets"
include/asterisk/astobj2.h:334: warning: function declaration isn't a prototype
include/asterisk/astobj2.h:530: error: syntax error before "uint"
include/asterisk/astobj2.h:530: warning: no semicolon at end of struct or union
include/asterisk/astobj2.h:534: error: syntax error before "version"
include/asterisk/astobj2.h:534: warning: type defaults to `int' in declaration of `version'
include/asterisk/astobj2.h:534: warning: data definition has no type or storage class
astobj2.c:299: warning: no previous prototype for 'ao2_container_alloc'
astobj2.c:525: error: return type is an incomplete type
astobj2.c:525: error: conflicting types for 'ao2_iterator_init'
include/asterisk/astobj2.h:537: error: previous declaration of 'ao2_iterator_init' was here
astobj2.c:525: error: conflicting types for 'ao2_iterator_init'
include/asterisk/astobj2.h:537: error: previous declaration of 'ao2_iterator_init' was here
astobj2.c: In function `ao2_iterator_init':
astobj2.c:526: error: variable `a' has initializer but incomplete type
astobj2.c:527: error: unknown field `c' specified in initializer
astobj2.c:527: warning: excess elements in struct initializer
astobj2.c:527: warning: (near initialization for `a')
astobj2.c:528: error: unknown field `flags' specified in initializer
astobj2.c:529: warning: excess elements in struct initializer
astobj2.c:529: warning: (near initialization for `a')
astobj2.c:526: error: storage size of 'a' isn't known
astobj2.c:531: warning: `return' with a value, in function returning void
astobj2.c:526: warning: unused variable `a'
astobj2.c: In function `ao2_iterator_next':
astobj2.c:543: error: dereferencing pointer to incomplete type
astobj2.c:546: error: dereferencing pointer to incomplete type
astobj2.c:547: error: dereferencing pointer to incomplete type
astobj2.c:552: error: dereferencing pointer to incomplete type
astobj2.c:552: error: dereferencing pointer to incomplete type
astobj2.c:552: error: dereferencing pointer to incomplete type
astobj2.c:556: error: dereferencing pointer to incomplete type
astobj2.c:557: error: dereferencing pointer to incomplete type
astobj2.c:558: error: dereferencing pointer to incomplete type
astobj2.c:561: error: dereferencing pointer to incomplete type
astobj2.c:569: error: dereferencing pointer to incomplete type
astobj2.c:569: error: dereferencing pointer to incomplete type
astobj2.c:569: error: dereferencing pointer to incomplete type
astobj2.c:569: warning: left-hand operand of comma expression has no effect
astobj2.c:571: error: dereferencing pointer to incomplete type
astobj2.c:571: error: dereferencing pointer to incomplete type
astobj2.c:572: error: dereferencing pointer to incomplete type
astobj2.c:579: error: dereferencing pointer to incomplete type
astobj2.c:580: error: dereferencing pointer to incomplete type
astobj2.c:581: error: dereferencing pointer to incomplete type
astobj2.c:581: error: dereferencing pointer to incomplete type
astobj2.c:587: error: dereferencing pointer to incomplete type
astobj2.c:588: error: dereferencing pointer to incomplete type
astobj2.c: At top level:
astobj2.c:716: warning: no previous prototype for 'astobj2_init'
astobj2.c: In function `ao2_iterator_next':
astobj2.c:569: warning: statement with no effect
make: *** [astobj2.o] Error 1

This appears to have cropped in whith the following change:

2008-05-05 17:53 +0000 [r115296]  Russell Bryant <russell@digium.com>

* Makefile, include/asterisk/astobj2.h (added), astobj2.c (added),
 include/asterisk/dlinkedlists.h (added), channels/chan_iax2.c:
 Merge changes from team/russell/iax2_find_callno_1.2 These
 changes address a critical performance issue introduced in the
 latest release. The fix for the latest security issue included a
 change that made Asterisk randomly choose call numbers to make
 them more difficult to guess by attackers. However, due to some
 inefficient (this is by far, an understatement) code, when
 Asterisk chose high call numbers, chan_iax2 became unusable after
 just a small number of calls. On a small embedded platform, it
 would not be able to handle a single call. On my Intel Core 2 Duo
 @ 2.33 GHz, I couldn't run more than about 16 IAX2 channels.
 Ouch. These changes address some performance issues of the
 find_callno() function that have bothered me for a very long
 time. On every incoming media frame, it iterated through every
 possible call number trying to find a matching active call. This
 involved a mutex lock and unlock for each call number checked.
 So, if the random call number chosen was 20000, then every media
 frame would cause 20000 locks and unlocks. Previously, this
 problem was not as obvious since Asterisk always chose the lowest
 call number it could. A second container for IAX2 pvt structs has
 been added. It is an astobj2 hash table. When we know the remote
 side's call number, the pvt goes into the hash table with a hash
 value of the remote side's call number. Then, lookups for
 incoming media frames are a very fast hash lookup instead of an
 absolutely insane array traversal. In a quick test, I was able to
 get more than 3600% more IAX2 channels on my machine with these
 changes.


****** STEPS TO REPRODUCE ******

Setup JDS CBE for spec file builds.

Apply the Makefile patch supplied

Run the build by executing:

pkgtool --interactive --download --pkgformat=ds build-only SFEast_1.2.spec

****** ADDITIONAL INFORMATION ******

We are currently running asterisk 1.2.24 on Solaris. We would like to upgrade to 1.2.30/1.2.30.1

We are able to successfully build all asterisk 1.2 version up to and including 1.2.28. From 1.2.28.1 and above the build fails with the above error.

Is there any chance in this being fixed as I am aware that 1.2 is currently unsupported?
Comments:By: Bruce McAlister (asgaroth) 2008-08-08 07:58:22

Hmm, I cannot seem to upload any files. Anyhow, here is the patch that I applied to the Makefile.

--- /var/tmp/Makefile   2008-08-08 12:24:01.312047000 +0100
+++ ./Makefile  2008-08-08 12:57:21.036389000 +0100
@@ -218,11 +218,11 @@
ID=id

ifeq ($(OSARCH),SunOS)
-  GREP=/usr/xpg4/bin/grep
-  M4=/usr/local/bin/m4
+  GREP=/usr/sfw/bin/ggrep
+  M4=/opt/jdsbld/bin/m4
  ID=/usr/xpg4/bin/id
-  LN=/usr/xpg4/bin/ln
-  INSTALL=ginstall
+  LN=/opt/jdsbld/bin/ln
+  INSTALL=/opt/jdsbld/bin/install
endif

INCLUDE+=-Iinclude -I../include
@@ -289,7 +289,7 @@

ifeq ($(OSARCH),SunOS)
  ASTCFLAGS+=-Wcast-align -DSOLARIS
-  INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/opt/ssl/include -I$(CROSS_COMPILE_TARGET)/usr/local/ssl/include
+  INCLUDE+=-Iinclude/solaris-compat -I$(CROSS_COMPILE_TARGET)/usr/sfw/include -I$(CROSS_COMPILE_TARGET)/usr/xpg4/include
  ifeq ($(OSCPU),sun4u)
    OPTIMIZE+=-mcpu=v9 -mcpu=ultrasparc
  endif
@@ -370,7 +370,7 @@
  LIBS+=-ldl -lpthread -lncurses -lm -lresolv  #-lnjamd
else
  ifeq ($(OSARCH),SunOS)
-    LIBS+=-lm -lcurses
+    LIBS+=-lm -lcurses -lrt
  else
    LIBS+=-lncurses -lm
  endif
@@ -403,10 +403,10 @@
endif

ifeq ($(OSARCH),SunOS)
-  LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
+  LIBS+=-lpthread -ldl -lnsl -lsocket -lresolv -L$(CROSS_COMPILE_TARGET)/usr/sfw/lib -L$(CROSS_COMPILE_TARGET)/usr/xpg4/lib
  OBJS+=strcompat.o
  ASTLINK=
-  SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/opt/ssl/lib -L$(CROSS_COMPILE_TARGET)/usr/local/ssl/lib
+  SOLINK=-shared -fpic -L$(CROSS_COMPILE_TARGET)/usr/sfw/lib -L$(CROSS_COMPILE_TARGET)/usr/xpg4/lib
endif

ifeq ($(MAKETOPLEVEL),$(MAKELEVEL))

By: Tilghman Lesher (tilghman) 2008-08-09 10:19:27

Fixed in SVN as of revision 136945.