Page 1 of 1

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

Posted: Fri Oct 26, 2018 8:52 pm
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/ objs/
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

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

Posted: Sat Oct 27, 2018 9:46 pm
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 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.

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

Posted: Sat Nov 03, 2018 6:18 am
by lhaley42
Thank you!