Compilation fails with gcc 4.1.2 on CentOS 5.9

Bug #1159053 reported by Gábor Csárdi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
igraph
Fix Committed
Medium
Tamás Nepusz

Bug Description

/bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -I/usr/include/libxml2 -g -O2 -I/usr/include/libxml2 -MT gss.lo -MD -MP -MF .deps/gss.Tpo -c -o gss.lo `test -f 'plfit/gss.c' || echo './'`plfit/gss.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -I/usr/include/libxml2 -g -O2 -I/usr/include/libxml2 -MT gss.lo -MD -MP -MF .deps/gss.Tpo -c plfit/gss.c -fPIC -DPIC -o .libs/gss.o
plfit/gss.c: In function 'gss':
plfit/gss.c:92: error: 'NAN' undeclared (first use in this function)
plfit/gss.c:92: error: (Each undeclared identifier is reported only once
plfit/gss.c:92: error: for each function it appears in.)
plfit/gss.c:93: error: 'INFINITY' undeclared (first use in this function)
make[3]: *** [gss.lo] Error 1
make[3]: Leaving directory `/home/csardi/src/igraph/igraph-0.6.5/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/csardi/src/igraph/igraph-0.6.5/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/csardi/src/igraph/igraph-0.6.5'
make: *** [all] Error 2
[csardi@localhost igraph-0.6.5]$ gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[csardi@localhost igraph-0.6.5]$ uname -a
Linux localhost.localdomain 2.6.18-348.el5 #1 SMP Tue Jan 8 17:53:53 EST 2013 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Interesting; NAN and INFINITY are defined in plfit/platform.h exactly to avoid this problem. Maybe it's picking up a different platform.h from somewhere else?

Revision history for this message
Gábor Csárdi (gabor.csardi) wrote :

platform.h has:

#ifdef _MSC_VER
#define snprintf sprintf_s
#define isnan(x) _isnan(x)
#ifndef INFINITY
# define INFINITY (DBL_MAX+DBL_MAX)
#endif

#ifndef NAN
# define NAN (INFINITY-INFINITY)
#endif

#endif

So this is for MSVC only, I guess. So you would need something like this:

#include <math.h>

#ifndef INFINITY
# define INFINITY (1.0/0.0)
#endif

#ifndef NAN
# define NAN (INFINITY-INFINITY)
#endif

Revision history for this message
Tamás Nepusz (ntamas) wrote : Re: [Bug 1159053] Re: Compilation fails with gcc 4.1.2 on CentOS 5.9

Damn, you are right. I will take care of the changes upstream and merge them back to igraph soon.

T.

On 23 Mar 2013, at 17:47, Gábor Csárdi <email address hidden> wrote:

> platform.h has:
>
> #ifdef _MSC_VER
> #define snprintf sprintf_s
> #define isnan(x) _isnan(x)
> #ifndef INFINITY
> # define INFINITY (DBL_MAX+DBL_MAX)
> #endif
>
> #ifndef NAN
> # define NAN (INFINITY-INFINITY)
> #endif
>
> #endif
>
> So this is for MSVC only, I guess. So you would need something like
> this:
>
> #include <math.h>
>
> #ifndef INFINITY
> # define INFINITY (1.0/0.0)
> #endif
>
> #ifndef NAN
> # define NAN (INFINITY-INFINITY)
> #endif
>
> --
> You received this bug notification because you are subscribed to igraph.
> https://bugs.launchpad.net/bugs/1159053
>
> Title:
> Compilation fails with gcc 4.1.2 on CentOS 5.9
>
> Status in The igraph library:
> New
>
> Bug description:
> /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -I/usr/include/libxml2 -g -O2 -I/usr/include/libxml2 -MT gss.lo -MD -MP -MF .deps/gss.Tpo -c -o gss.lo `test -f 'plfit/gss.c' || echo './'`plfit/gss.c
> libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -I/usr/include/libxml2 -g -O2 -I/usr/include/libxml2 -MT gss.lo -MD -MP -MF .deps/gss.Tpo -c plfit/gss.c -fPIC -DPIC -o .libs/gss.o
> plfit/gss.c: In function 'gss':
> plfit/gss.c:92: error: 'NAN' undeclared (first use in this function)
> plfit/gss.c:92: error: (Each undeclared identifier is reported only once
> plfit/gss.c:92: error: for each function it appears in.)
> plfit/gss.c:93: error: 'INFINITY' undeclared (first use in this function)
> make[3]: *** [gss.lo] Error 1
> make[3]: Leaving directory `/home/csardi/src/igraph/igraph-0.6.5/src'
> make[2]: *** [all] Error 2
> make[2]: Leaving directory `/home/csardi/src/igraph/igraph-0.6.5/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/csardi/src/igraph/igraph-0.6.5'
> make: *** [all] Error 2
> [csardi@localhost igraph-0.6.5]$ gcc --version
> gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
> Copyright (C) 2006 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> [csardi@localhost igraph-0.6.5]$ uname -a
> Linux localhost.localdomain 2.6.18-348.el5 #1 SMP Tue Jan 8 17:53:53 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/igraph/+bug/1159053/+subscriptions

Revision history for this message
Tamás Nepusz (ntamas) wrote :

FIxed in b69198861cfc12dc5f63d5e92e57984036dac598 in the develop branch.

Changed in igraph:
importance: Undecided → Medium
assignee: nobody → Tamás Nepusz (ntamas)
status: New → Fix Committed
milestone: none → 0.7
Revision history for this message
Gábor Csárdi (gabor.csardi) wrote :

AFAIK not all platforms have DBL_MAX, so I think it is better to define INFINITY as (1.0/0.0).

Revision history for this message
Tamás Nepusz (ntamas) wrote :

Thanks, fixed in 3149396d275401380ebfc5383b1e912dbff11087 in the develop branch.

Revision history for this message
Gábor Csárdi (gabor.csardi) wrote : Continue on github

The development of igraph has moved to github, so please do not comment on this bug here. You are of course welcome to comment on github, here:
https://github.com/igraph/igraph/issues/256

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.