[BUG&FIX] error: '__builtin_isfinite' is not a member of 'std'

Here you can discuss and share functionality improvements and helper programs to make Context Free better.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
lhaley42
Posts: 2
Joined: Fri Oct 26, 2018 8:36 pm

[BUG&FIX] error: '__builtin_isfinite' is not a member of 'std'

Post by lhaley42 »

using GCC 7.2.0 - on linux, I get a compile error; error: '__builtin_isfinite' is not a member of 'std'. googling this led me to a workaround:

The Fix:
tc@box:~/src/ContextFree$ CPPFLAGS=-D_GLIBCXX_USE_C99_MATH=1 make

The Error:
tc@box:~/src/ContextFree$ make
[...]
g++ -Isrc-common -Isrc-unix -Iobjs -Isrc-common/agg-extras -Isrc-ffmpeg/include -I/usr/local/include -Isrc-agg -Isrc-agg/agg2 -O2 -Wall -Wextra -march=native -Wno-parentheses -std=c++14 -c -o objs/cfdg.tab.o objs/cfdg.tab.cpp
In file included from /tmp/tcloop/gcc/usr/local/include/c++/7.2.0/cmath:45:0,
from /tmp/tcloop/gcc/usr/local/include/c++/7.2.0/math.h:36,
from src-agg/agg2/agg_math.h:22,
from src-agg/agg2/agg_math_stroke.h:23,
from src-common/ast.h:32,
from src-common/astreplacement.h:29,
from src-common/cfdg.ypp:64:
src-common/bounds.h: In member function 'bool Bounds::valid() const':
src-common/bounds.h:41:23: error: '__builtin_isfinite' is not a member of 'std'
#define myfinite std::isfinite
^
src-common/bounds.h:59:37: note: in expansion of macro 'myfinite'
bool valid() const { return myfinite(mMin_X) && myfinite(mMax_X) &&
^~~~~~~~
src-common/bounds.h:41:23: note: suggested alternative:
#define myfinite std::isfinite

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: [BUG&FIX] error: '__builtin_isfinite' is not a member of 'std'

Post by MtnViewJohn »

I don't see this with gcc 7.3 on the HEAD revision. As near as I can tell, gcc 7.3 automatically defines _GLIBCXX_USE_C99_MATH in C++ files. I would be interested to know if this happens with gcc 7.2 and HEAD at https://github.com/MtnViewJohn/context-free Adding this define to the Makefile looks like a harmless change.

It seems to be an issue with source files that include math.h and cmath. Now that Visual C++ 2017 finally has std::isfinite, I have removed the myfinite macro and many inclusions of math.h. Agg and libav still use math.h extensively.

lhaley42
Posts: 2
Joined: Fri Oct 26, 2018 8:36 pm

Re: [BUG&FIX] error: '__builtin_isfinite' is not a member of 'std'

Post by lhaley42 »

Thank you!

Post Reply