Thread: fails to compile with undefined symbol (FP_PLUS_INF)

fails to compile with undefined symbol (FP_PLUS_INF)

From
"Riccardo Mottola"
Date:
when compiling psql 8.1.3 using gcc 3.4.5 on AIX 4.2.1 on powerpc32 I
get the following error:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
-Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
-I../../src/port -DFRONTEND -I../../src/include -I/usr/local/include
-c isinf.c -o isinf.o
isinf.c: In function `isinf':
isinf.c:69: error: `FP_PLUS_INF' undeclared (first use in this function)
isinf.c:69: error: (Each undeclared identifier is reported only once
isinf.c:69: error: for each function it appears in.)
isinf.c:71: error: `FP_MINUS_INF' undeclared (first use in this function)
make[2]: *** [isinf.o] Error 1


configure options where:
./configure --with-includes=/usr/local/include
--with-libs=/usr/local/lib --without-readline

any ideas? patches? is this already known?

thanks,
  Riccardo

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Seneca Cunningham
Date:
Riccardo Mottola wrote:
> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
> -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
> -I../../src/port -DFRONTEND -I../../src/include -I/usr/local/include
> -c isinf.c -o isinf.o
> isinf.c: In function `isinf':
> isinf.c:69: error: `FP_PLUS_INF' undeclared (first use in this function)
> isinf.c:69: error: (Each undeclared identifier is reported only once
> isinf.c:69: error: for each function it appears in.)
> isinf.c:71: error: `FP_MINUS_INF' undeclared (first use in this function)
> make[2]: *** [isinf.o] Error 1

Are FP_PLUS_INF and FP_MINUS_INF defined in float.h or math.h?  The
oldest docs that I found were for AIX 4.3 and what I could gather from
them is that the code should compile.

--
Seneca Cunningham
scunning@ca.afilias.info

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
"Riccardo Mottola"
Date:
Hey,

our faithful grep tool says:
bash-2.01$ grep FP_PLUS_INF *
float.h:#define FP_PLUS_INF       4
bash-2.01$ grep FP_MINUS_INF *
float.h:#define FP_MINUS_INF      5


On 3/16/06, Seneca Cunningham <scunning@ca.afilias.info> wrote:
> Riccardo Mottola wrote:
> > gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
> > -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
> > -I../../src/port -DFRONTEND -I../../src/include -I/usr/local/include
> > -c isinf.c -o isinf.o
> > isinf.c: In function `isinf':
> > isinf.c:69: error: `FP_PLUS_INF' undeclared (first use in this function)
> > isinf.c:69: error: (Each undeclared identifier is reported only once
> > isinf.c:69: error: for each function it appears in.)
> > isinf.c:71: error: `FP_MINUS_INF' undeclared (first use in this function)
> > make[2]: *** [isinf.o] Error 1
>
> Are FP_PLUS_INF and FP_MINUS_INF defined in float.h or math.h?  The
> oldest docs that I found were for AIX 4.3 and what I could gather from
> them is that the code should compile.
>
> --
> Seneca Cunningham
> scunning@ca.afilias.info
>

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Tom Lane
Date:
"Riccardo Mottola" <multix@gmail.com> writes:
> our faithful grep tool says:
> bash-2.01$ grep FP_PLUS_INF *
> float.h:#define FP_PLUS_INF       4
> bash-2.01$ grep FP_MINUS_INF *
> float.h:#define FP_MINUS_INF      5

These must be within #if's that prevent them from being seen ...
you'll need to figure out what exactly.  On HPUX we use
    CPPFLAGS="-D_XOPEN_SOURCE_EXTENDED"
to gain access to some symbols we need, and I'll bet something
similar is needed on AIX.

            regards, tom lane

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Seneca Cunningham
Date:
Riccardo Mottola wrote:
> our faithful grep tool says:
> bash-2.01$ grep FP_PLUS_INF *
> float.h:#define FP_PLUS_INF       4
> bash-2.01$ grep FP_MINUS_INF *
> float.h:#define FP_MINUS_INF      5

Is there a float.h in your gcc install directory?  Is it #included
instead of /usr/include/float.h by gcc?  My faithful grep tool says:

-bash-2.05b$ grep FP_MINUS_INF /usr/include/*
/usr/include/float.h:#define FP_MINUS_INF      5
/usr/include/math.h:#define FP_MINUS_INF      5

The float.h that's part of gcc doesn't contain the defines.

> On 3/16/06, Seneca Cunningham <scunning@ca.afilias.info> wrote:
>> Riccardo Mottola wrote:
>>> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline
>>> -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
>>> -I../../src/port -DFRONTEND -I../../src/include -I/usr/local/include
>>> -c isinf.c -o isinf.o
>>> isinf.c: In function `isinf':
>>> isinf.c:69: error: `FP_PLUS_INF' undeclared (first use in this function)
>>> isinf.c:69: error: (Each undeclared identifier is reported only once
>>> isinf.c:69: error: for each function it appears in.)
>>> isinf.c:71: error: `FP_MINUS_INF' undeclared (first use in this function)
>>> make[2]: *** [isinf.o] Error 1
>> Are FP_PLUS_INF and FP_MINUS_INF defined in float.h or math.h?  The
>> oldest docs that I found were for AIX 4.3 and what I could gather from
>> them is that the code should compile.


--
Seneca Cunningham
scunning@ca.afilias.info

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
"Riccardo Mottola"
Date:
Hello,

> Is there a float.h in your gcc install directory?  Is it #included
> instead of /usr/include/float.h by gcc?  My faithful grep tool says:
>
> -bash-2.05b$ grep FP_MINUS_INF /usr/include/*
> /usr/include/float.h:#define FP_MINUS_INF      5
> /usr/include/math.h:#define FP_MINUS_INF      5
>
> The float.h that's part of gcc doesn't contain the defines.

yes, exactly.  lib/gcc/powerpc-ibm-aix4.2.1.0/3.4.5/include/float.h

and indeed, it has not those defines.
As far as I know, the gcc includes have always precedence. Maybe you
should run a configure check?
Do you know a workaround?

-R

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Seneca Cunningham
Date:
Riccardo Mottola wrote:
> Hello,
>
>> Is there a float.h in your gcc install directory?  Is it #included
>> instead of /usr/include/float.h by gcc?  My faithful grep tool says:
>>
>> -bash-2.05b$ grep FP_MINUS_INF /usr/include/*
>> /usr/include/float.h:#define FP_MINUS_INF      5
>> /usr/include/math.h:#define FP_MINUS_INF      5
>>
>> The float.h that's part of gcc doesn't contain the defines.
>
> yes, exactly.  lib/gcc/powerpc-ibm-aix4.2.1.0/3.4.5/include/float.h
>
> and indeed, it has not those defines.
> As far as I know, the gcc includes have always precedence. Maybe you
> should run a configure check?
> Do you know a workaround?

Something that may work would be to take the block of defines output by:

grep -p FP_MINUS_INF /usr/include/*

and add it to the math.h in the gcc directory.  I don't have a 4.2 box
here so I can't test this, but the math.h in my gcc directory does
contain the defines.  That math.h should be similar to the math.h in
/usr/include.

--
Seneca Cunningham
scunning@ca.afilias.info

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Tom Lane
Date:
"Riccardo Mottola" <multix@gmail.com> writes:
>> The float.h that's part of gcc doesn't contain the defines.

> yes, exactly.  lib/gcc/powerpc-ibm-aix4.2.1.0/3.4.5/include/float.h
> and indeed, it has not those defines.

Ah-hah.  This probably indicates that the gcc you are using was
originally generated on a different version of AIX.  It's always bad
news when gcc's copies of the headers don't match the real ones :-(

These copies are generated during gcc build by a script called
"fixincludes".  You might be able to fix them up by just re-running
fixincludes.  My inclination would be to rebuild gcc altogether though.

            regards, tom lane

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Seneca Cunningham
Date:
Tom Lane wrote:
> "Riccardo Mottola" <multix@gmail.com> writes:
>>> The float.h that's part of gcc doesn't contain the defines.
>
>> yes, exactly.  lib/gcc/powerpc-ibm-aix4.2.1.0/3.4.5/include/float.h
>> and indeed, it has not those defines.
>
> Ah-hah.  This probably indicates that the gcc you are using was
> originally generated on a different version of AIX.  It's always bad
> news when gcc's copies of the headers don't match the real ones :-(
>
> These copies are generated during gcc build by a script called
> "fixincludes".  You might be able to fix them up by just re-running
> fixincludes.  My inclination would be to rebuild gcc altogether though.

My gcc build is like that and I was the one who built it to replace
another build of gcc.  gcc doesn't seem to like float.h on AIX and just
uses its own as part of fixincludes; math.h comes out in a more intact
state.  This means that on AIX versions where math.h also contains
FP_PLUS_INF (and the rest of that block of defines), the defines do
occur.  It would appear that 4.2 doesn't also contain the necessary
defines as part of math.h (protected by an #ifndef on 5.3).

--
Seneca Cunningham
scunning@ca.afilias.info

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
"Riccardo Mottola"
Date:
Hello,

On 3/16/06, Seneca Cunningham <scunning@ca.afilias.info> wrote:
> Ah-hah.  This probably indicates that the gcc you are using was
> originally generated on a different version of AIX.  It's always bad
> news when gcc's copies of the headers don't match the real ones :-(

incorrect: i built the  gcc myself by boostrapping from an older binary gcc. I did exactly to avoid this kind of problems.

>
> These copies are generated during gcc build by a script called
> "fixincludes".  You might be able to fix them up by just re-running
> fixincludes.  My inclination would be to rebuild gcc altogether though.

My gcc build is like that and I was the one who built it to replace
another build of gcc.  gcc doesn't seem to like float.h on AIX and just
uses its own as part of fixincludes; math.h comes out in a more intact
state.  This means that on AIX versions where math.h also contains
FP_PLUS_INF (and the rest of that block of defines), the defines do
occur.  It would appear that 4.2 doesn't also contain the necessary
defines as part of math.h (protected by an #ifndef on 5.3).

 
yes, that seems to be it: float.h gets replaced and I don't have the defines in math.h too thus you have more redundancy. I might just hack the gcc include at this point.
fixinclude b0rked it.

-R

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Tom Lane
Date:
Seneca Cunningham <scunning@ca.afilias.info> writes:
> Tom Lane wrote:
>> These copies are generated during gcc build by a script called
>> "fixincludes".  You might be able to fix them up by just re-running
>> fixincludes.  My inclination would be to rebuild gcc altogether though.

> My gcc build is like that and I was the one who built it to replace
> another build of gcc.  gcc doesn't seem to like float.h on AIX and just
> uses its own as part of fixincludes; math.h comes out in a more intact
> state.

I'd call that a gcc bug...

            regards, tom lane

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Seneca Cunningham
Date:
Riccardo Mottola wrote:
> Hello,
>
> On 3/16/06, *Seneca Cunningham* <scunning@ca.afilias.info
> <mailto:scunning@ca.afilias.info>> wrote:
>     My gcc build is like that and I was the one who built it to replace
>     another build of gcc.  gcc doesn't seem to like float.h on AIX and just
>     uses its own as part of fixincludes; math.h comes out in a more intact
>     state.  This means that on AIX versions where math.h also contains
>     FP_PLUS_INF (and the rest of that block of defines), the defines do
>     occur.  It would appear that 4.2 doesn't also contain the necessary
>     defines as part of math.h (protected by an #ifndef on 5.3).
>
>
> yes, that seems to be it: float.h gets replaced and I don't have the
> defines in math.h too thus you have more redundancy. I might just hack
> the gcc include at this point.
> fixinclude b0rked it.

I took a quick look at gcc 4.0.1's build scripts (what I'm running).  It
would appear that gcc blindly replaces limits.h, float.h, iso646.h,
stdarg.h, stdbool.h, stddef.h, varargs.h, and unwind.h.  Of these,
limits.h is the only one that then includes the native header.  They
aren't modified by fixincludes.  fixincludes takes a hack at the other
headers that end up in gcc's include directory.

--
Seneca Cunningham
scunning@ca.afilias.info

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
"Riccardo Mottola"
Date:
Hey,

> I took a quick look at gcc 4.0.1's build scripts (what I'm running).  It
> would appear that gcc blindly replaces limits.h, float.h, iso646.h,
> stdarg.h, stdbool.h, stddef.h, varargs.h, and unwind.h.  Of these,
> limits.h is the only one that then includes the native header.  They
> aren't modified by fixincludes.  fixincludes takes a hack at the other
> headers that end up in gcc's include directory.

I failed a bug report to gcc (26768) and it got closed saying that it
is float.h is fine to be replaced since those constants FP_* are non
standard, please have a look yourself.

Cheers,
   Riccardo

Re: fails to compile with undefined symbol (FP_PLUS_INF)

From
Seneca Cunningham
Date:
Riccardo Mottola wrote:
> Hey,
>
>> I took a quick look at gcc 4.0.1's build scripts (what I'm running).  It
>> would appear that gcc blindly replaces limits.h, float.h, iso646.h,
>> stdarg.h, stdbool.h, stddef.h, varargs.h, and unwind.h.  Of these,
>> limits.h is the only one that then includes the native header.  They
>> aren't modified by fixincludes.  fixincludes takes a hack at the other
>> headers that end up in gcc's include directory.
>
> I failed a bug report to gcc (26768) and it got closed saying that it
> is float.h is fine to be replaced since those constants FP_* are non
> standard, please have a look yourself.

I took a look at some docs[1], and it seems like the gcc people are
correct in that the standard does not define any constants FP_FOO in
float.h.  They say that definitions starting with FP_ are to be in math.h.

[1] http://www.opengroup.org/onlinepubs/000095399/basedefs/math.h.html

--
Seneca Cunningham
scunning@ca.afilias.info