Compile Error

M

Mikail Dellovich

I am on a Solaris 10 6/06 SPARC machine. I tried to compile sound player
app for Asterisk and got the following error:

Can someone provide an explanation or work around? Thanks!

xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3> gmake
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -O6
-I/usr/include/ -I/u01/app/oracle/product/primary/rdbms/public/
-I/usr/local/include -I/usr/local/openldap/include
-I/usr/local/BerkeleyDB.4.4/include -I/usr/local/ssl/include
-I/usr/local/imap-2006a/include -I/usr/local/pgsql/include
-I/usr/local/mysql/include/mysql/include -I/opt/asterisk/usr/include -c
-o format_mp3.o format_mp3.c
In file included from /opt/asterisk/usr/include/asterisk/channel.h:109,
from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/frame.h:289: error: syntax error
before 'u_int16_t'
/opt/asterisk/usr/include/asterisk/frame.h:289: warning: no semicolon at
end of struct or union
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: type defaults
to 'int' in declaration of 'data'
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: data definition
has no type or storage class
/opt/asterisk/usr/include/asterisk/frame.h:300: error: syntax error
before '}' token
In file included from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/channel.h: In function 'ast_select':
/opt/asterisk/usr/include/asterisk/channel.h:1159: warning: implicit
declaration of function 'timersub'
gmake: *** [format_mp3.o] Error 1


Offending lines of code:

struct ast_option_header {
/* Always keep in network byte order */
#if __BYTE_ORDER == __BIG_ENDIAN
u_int16_t flag:3;
u_int16_t option:13;
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int16_t option:13;
u_int16_t flag:3;
#else
#error Byte order not defined
#endif
#endif
u_int8_t data[0];
}; //line 300 frame.h



GCC version:

xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3> gcc -v
Using built-in specs.
Target: sparc-sun-solaris2.10
Configured with:
/net/tibia/export/bldmstr/nightly/20060817_mars_gcc.s10.opt.tarbuild/src/configure
--prefix=/opt/gcc --enable-shared --with-system-zlib
--enable-checking=release --disable-libmudflap --enable-languages=c,c++
--enable-version-specific-runtime-libs
--with-gxx-include-dir=/opt/gcc/include/c++/4.0.3 --with-cpu=v9
Thread model: posix
gcc version 4.0.3 (gccfss)
 
K

Kohn Emil Dan

I am on a Solaris 10 6/06 SPARC machine. I tried to compile sound player app
for Asterisk and got the following error:

Can someone provide an explanation or work around? Thanks!

xxdev2:12:24:/opt/sft/voip/asterisk-addons-1.2.5/format_mp3> gmake
gcc -pipe -fPIC -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-declarations -D_REENTRANT -D_GNU_SOURCE -O6 -I/usr/include/
-I/u01/app/oracle/product/primary/rdbms/public/ -I/usr/local/include
-I/usr/local/openldap/include -I/usr/local/BerkeleyDB.4.4/include
-I/usr/local/ssl/include -I/usr/local/imap-2006a/include
-I/usr/local/pgsql/include -I/usr/local/mysql/include/mysql/include
-I/opt/asterisk/usr/include -c -o format_mp3.o format_mp3.c
In file included from /opt/asterisk/usr/include/asterisk/channel.h:109,
from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/frame.h:289: error: syntax error before
'u_int16_t'
/opt/asterisk/usr/include/asterisk/frame.h:289: warning: no semicolon at end
of struct or union
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: type defaults to
'int' in declaration of 'data'
/opt/asterisk/usr/include/asterisk/frame.h:299: warning: data definition has
no type or storage class
/opt/asterisk/usr/include/asterisk/frame.h:300: error: syntax error before
'}' token
In file included from format_mp3.c:21:
/opt/asterisk/usr/include/asterisk/channel.h: In function 'ast_select':
/opt/asterisk/usr/include/asterisk/channel.h:1159: warning: implicit
declaration of function 'timersub'
gmake: *** [format_mp3.o] Error 1


Offending lines of code:

struct ast_option_header {
/* Always keep in network byte order */
#if __BYTE_ORDER == __BIG_ENDIAN
u_int16_t flag:3;
u_int16_t option:13;
#else
#if __BYTE_ORDER == __LITTLE_ENDIAN
u_int16_t option:13;
u_int16_t flag:3;
#else
#error Byte order not defined
#endif
#endif
u_int8_t data[0];
}; //line 300 frame.h
<snip>

I suppose the problem is that the compiler could not find a definition of
the u_int16_t type. A workaround would be to add an appropriate definition
of u_int16_t before the usage. As far as I know, Solaris defines the
uint16_t type (notice the missing underscore between after 'u'). So adding
the following lines before the definition of struct ast_option_header
might help:

#include <stdint.h>

typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;

You should bracket the definitions with a platform-specific
#ifdef / #endif

Posting to a Solaris specific programming group might help as well.

Emil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top