[ntp:questions] GCC-4.2.3 Compiler Error in NTP-4.2.2p4
see at signature.invalid
Sun Feb 10 19:34:14 UTC 2008
[I'm replying to the original article rather than later follow-ups
in order to include some original error messages.]
In article <slrnfqrnc2.1gue.lausts at laus.org>, Thomas Laus <lausts at acm.org> writes:
> I tried to upgrade my ntp version running on a FreeBSD 6.3-STABLE
> system this morning and received the following error:
> if cc -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I../include -I../libopts \
> -I/usr/local/include -O2 -fno-strict-aliasing -pipe \
> -Wall -Wcast-qual -Wmissing-prototypes -Wpointer-arith -Wshadow \
> -Wstrict-prototypes -MT ntp_timer.o -MD -MP -MF ".deps/ntp_timer.Tpo" \
> -c -o ntp_timer.o ntp_timer.c; then mv -f ".deps/ntp_timer.Tpo" \
> ".deps/ntp_timer.Po"; else rm -f ".deps/ntp_timer.Tpo"; exit 1; fi
> ntp_timer.c: In function `reinit_timer':
> ntp_timer.c:104: warning: implicit declaration of function `timer_gettime'
> ntp_timer.c:105: error: invalid use of undefined type `struct itimerspec'
> The compiler is GCC-4.2.3_20080130 and the ntp version that I was
> attempting to upgrade to was ntp-4.2.2p4. This version was able
> to be upgraded using the default GCC compiler on another system.
> It would appear that GCC-4.2.3 does not like something in the
> 'ntp_timer.c' program. Is there something that I need to do for
> the upgrade to complete successfully?
timer_gettime and the associated data structure struct itimerspec
are part of the POSIX REALTIME option, and are not supported
in FreeBSD 6. (I have seen some documentation that they are
available in the imminently available FreeBSD 7 line.)
Thus, the issue is almost certainly not with the gcc compiler but
rather the configuration of the NTP distribution: it shouldn't
have chosen to use timer_create but rather setitimer. In looking
at the NTP distribution, it's not clear to me why this should
fail. Are you sure that you started with a clean distribution
I recently compiled and installed ntp-4.2.4p4 on FreeBSD 6.3-RELEASE
using the FreeBSD ports system (and the default gcc 3.4.6), and
it compiled and now operates without any obvious errors. I note,
however, that the FreeBSD people have provided two small patch files
-- both associated with configuring the stock NTP distribution for
use on the various release versions of FreeBSD.
I just tried configuring that version of ntp using the supplied
configuration tools (i.e., w/o the FreeBSD patch files), and it
properly detected the lack of timer_create (i.e., it wrote
"/* #undef HAVE_TIMER_CREATE */" in the top level config.h). It
also compiled successfully using gcc 4.3.0 20071221. So, I really
would suspect stale configuration files on your system.
I'm not sure of the level of your programming experience as this
"compiler error" should have been relatively simple to diagnose
given access to the NTP source, the grep command, and the FreeBSD
man pages; yet you appear to be running a version of FreeBSD from
the source repository (rather than a released system). In any
case, I would suggest strongly that you consider using the FreeBSD
ports system as it drastically reduces the stress associated with
maintaining third-party system software. You could start by reading
the FreeBSD handbook and/or the "ports" man page, both of which
are part of the standard FreeBSD installation.
. Douglas Wells . Connection Technologies .
. Internet: -sp9804- -at - contek.com- .
More information about the questions