Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 371601 - media-libs/gegl - reinhard05.c: In function 'reinhard05_stats_start': reinhard05.c:88: error: 'NAN' undeclared (first use in this function)
Summary: media-libs/gegl - reinhard05.c: In function 'reinhard05_stats_start': reinhar...
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
Depends on:
Reported: 2011-06-14 11:41 UTC by Rabbe Fogelholm
Modified: 2017-11-14 13:22 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

Adds -std=gnu99 to CFLAGS (media-libs_gegl-0.2.0.patch,4.22 KB, text/plain)
2012-06-23 20:32 UTC, Palmer Dabbelt

Note You need to log in before you can comment on or make changes to this bug.
Description Rabbe Fogelholm 2011-06-14 11:41:02 UTC
Platform is Gentoo Prefix on SUSE Enterprise 10 SP2. media-libs/gegl-0.1.6 fails to emerge, which in turn stops gimp from being emerged.

The console output looks like:

reinhard05.c: In function 'reinhard05_stats_start':
reinhard05.c:88: error: 'NAN' undeclared (first use in this function)
reinhard05.c:88: error: (Each undeclared identifier is reported only once
reinhard05.c:88: error: for each function it appears in.)
make[4]: *** [] Error 1
make[4]: Leaving directory `/local/scratch/portage/media-libs/gegl-0.1.6/work/gegl-0.1.6/operations/common'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/local/scratch/portage/media-libs/gegl-0.1.6/work/gegl-0.1.6/operations/common'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/local/scratch/portage/media-libs/gegl-0.1.6/work/gegl-0.1.6/operations'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/local/scratch/portage/media-libs/gegl-0.1.6/work/gegl-0.1.6'
make: *** [all] Error 2
 * ERROR: media-libs/gegl-0.1.6 failed (compile phase):
 *   emake failed
Comment 1 Dmitry Ivankov 2011-06-21 11:27:42 UTC
Looks like a bug in gegl, forgotten #include <math.h>.

I've hacked around it with CFLAGS="-DNAN=__builtin_nanf\\(\\\"\\\"\\)" emerge -1 gegl. Stole it from my math.h and my gcc>=3.3.
Proper way is to add a patch of course.
Comment 2 Rabbe Fogelholm 2011-06-22 07:18:35 UTC
Thanks Dmitry! With your workaround I can again emerge 'gegl'.
Comment 3 Rob Kay 2011-07-01 10:10:06 UTC
Same problem here. Thanks for solution!

export CFLAGS="-DNAN=\"(0.0/0.0)\""
then emerge -1 gegl
Comment 4 Palmer Dabbelt 2012-06-23 20:32:17 UTC
Created attachment 316101 [details]
Adds -std=gnu99 to CFLAGS

This problem still exists for me when using media-libs/gegl-0.2.0 on a Red Hat 5, ~amd64-linux Gentoo prefix.  There's actually a few more failures now, but it seems that they're all related to floating point stuff.  The missing definitions are NAN and fminf, both of which seem to need _ISOC99_SOURCE defined.

I've attached a patch that adds "-std=gnu99" to CFLAGS, which allows gegl-0.2.0 to build.  I think this is correct as the package seems to be using GNU C extensions (when I just added "-std=c99" the build still failed, I didn't look closely).

With the attached patch applied, medias-libs/gegl-0.2.0 builds on my ~amd64-prefix.
Comment 5 Wilfred Hughes 2014-05-09 14:29:45 UTC
I'm also on a RHEL 5 machine running Gentoo Prefix, and I can confirm using those CFLAGS fixes the compilation error.
Comment 6 Wilfred Hughes 2014-05-09 15:28:41 UTC
Upstream bug, upstream is not convinced that the fix should be their end:
Comment 7 Fabian Groffen gentoo-dev 2017-11-14 13:22:19 UTC
I'm sorry, but I believe the package and OS changed considerably since.