[Asterisk-bsd] FreeBSD & -current
Ryan Mansager
rmger@nrez.net
Tue, 08 Jun 2004 14:43:11 -0700
New to Asterisk. Just curious as to whether -current is expected to
compile on FreeBSD or not. I get the following error after a fresh cvs
checkout:
In file included from localtime.c:27:
../include/asterisk/lock.h: In function `ast_mutex_init':
../include/asterisk/lock.h:183: `PTHREAD_MUTEX_RECURSIVE_NP' undeclared
(first use in this function)
../include/asterisk/lock.h:183: (Each undeclared identifier is reported
only once
../include/asterisk/lock.h:183: for each function it appears in.)
localtime.c: At top level:
localtime.c:187: `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' undeclared
here (not in a function)
localtime.c:188: `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' undeclared
here (not in a function)
localtime.c:189: `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' undeclared
here (not in a function)
localtime.c:190: `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' undeclared
here (not in a function)
localtime.c: In function `gmtsub':
localtime.c:1088: warning: assignment discards qualifiers from pointer
target type
gmake[1]: *** [localtime.o] Error 1
gmake[1]: Leaving directory `/home/rmger/src/asterisk/stdtime'
gmake: *** [stdtime/libtime.a] Error 2
Adding "#define _GNU_SOURCE" before the includes at the top of lock.h
does not fix the problem in this case (as it apparently does with
similar problems in rxfax & txfax).
More specifically, it appears to be this chunk from lock.h:
--
/* From now on, Asterisk REQUIRES Recursive (not error checking) mutexes
and will not run without them. */
#define AST_MUTEX_INITIALIZER {
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, NULL, 0, NULL, 0 }
#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE_NP
--
that specifically references PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
(which doesn't exist anywhere in my /usr/include/*) whereas back in the
lock.h in version 0.9.0 (the version used in the FreeBSD port), if it
hadn't previously been defined, AST_MUTEX_INITIALIZER falls back to
using PTHREAD_MUTEX_INITIALIZER (which does exist in my
/usr/include/pthread.h).
I'm running FreeBSD 4.8-STABLE on this specific machine (although the
definition in question doesn't exist in my pthread.h on a new 5.2.1
installation) and I'm not a big C coder. Just making some observations
that someone might be able to help shed some light on.
Suggestions?
Thanks much,
-Ryan