On Mon, 26 Jan 2004 23:03:50 -0500
Eric L Hathaway <[EMAIL PROTECTED]> wrote:

> Allow me to de-lurk for a minute to report a compilation problem, along 
> with a fix.
> 
> Current (10:00pm EST, 2003-1-26) CVS checkouts of FlightGear fail to 
> compile on my Linux box.  Here is the relevant part of the output from 
> 'make', showing the error:
> 
> --- Begin ---
> g++ -DHAVE_CONFIG_H -I. -I. -I../../src/Include -I../.. -I../../src 
> -I/usr/X11R6/include  -Wall -O5 -fomit-frame-pointer -ffast-math 
> -funroll-loops -march=athlon -D_REENTRANT -c -o panel.o `test -f 
> panel.cxx || echo './'`panel.cxx
> panel.cxx: In method `const char *FGTextLayer::Chunk::getValue ()
> const':
> panel.cxx:1128: `truncf' undeclared (first use this function)
> panel.cxx:1128: (Each undeclared identifier is reported only once for
> each function it appears in.)
> make[3]: *** [panel.o] Error 1
> --- End ---
> 
> It would appear that the truncf function is not being declared.  I did 
> some searching on Google, and quickly found a thread starting with the 
> following message posted to a glibc mailing list:
> 
> http://sources.redhat.com/ml/bug-glibc/2001-10/msg00015.html
> 
> Apparently, the truncf function was introduced in the C99 standard, and 
> to use such functions in glibc you must define _ISOC99_SOURCE (or 
> _GNU_SOURCE) in order for the functions to be properly declared by 
> <math.h>.  See the follow-up messages to the above glibc mailing list 
> posting for more info.  I wrote a simple five line C program to test 
> truncf, and indeed it didn't work properly unless I added 
> -D_ISOC99_SOURCE or -D_GNU_SOURCE to the list of arguments to gcc.
> 
> I checked that this compilation problem occurs, and the above fix works, 
> on both a machine running Red Hat 7.3 (glibc-2.2.5, gcc-2.96), and 
> another running Red Hat 9 (glibc-2.3.2, gcc-3.2.2).

Compiles okay on Mandrake 9.2/10.0 (glibc-2.3.3 and gcc-3.3.2).  However this
should really be tested for by the configure script - AC_CHECK_FUNCS(truncf)
and panel.cxx should then contain:

#ifndef HAVE_TRUNCF
inline float truncf (float d) { ...
#endif

Cheers,
Bernie

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to