Testing libexpat, error: 'NAN' was not declared in this scope

Jeffrey Walton noloader at gmail.com
Thu Feb 24 21:08:53 CET 2022


On Wed, Feb 23, 2022 at 10:33 AM Jeffrey Walton <noloader at gmail.com> wrote:
>
> I'm trying to compile libexpat 2.4.5 on SOlaris 11.4. It has that
> antique GCC 4.8.2. The build is failing:
>
> $ make check -k
> ...
> /bin/g++ -DHAVE_CONFIG_H -I. -I..   -DXML_ENABLE_VISIBILITY=1
> -I./../lib -I/opt/ssh/incl
> ude -DNDEBUG -Wall   -fexceptions -fno-strict-aliasing -g2 -O2 -m64
> -march=native -fPIC
> -pthread -MT runtestspp.o -MD -MP -MF .deps/runtestspp.Tpo -c -o
> runtestspp.o runtestspp
> .cpp
> In file included from runtestspp.cpp:36:0:
> runtests.c: In function 'void test_billion_laughs_attack_protection_api()':
> runtests.c:11712:32: error: 'NAN' was not declared in this scope
>           parserWithoutParent, NAN)
>                                ^
> runtests.c:11734:32: error: 'INFINITY' was not declared in this scope
>           parserWithoutParent, INFINITY)
>                                ^
> *** Error code 1
>
> I've included <sunmath.h> but the defines/symbols are still missing. I
> also included headers mentioned at
> https://docs.oracle.com/cd/E19957-01/806-3568/ncg_lib.html. I'm out of
> ideas.
>
> Does anyone know what to include to get those symbols?

Sebastian checked in a fix for this. See
https://github.com/libexpat/libexpat/issues/569.

I did not realize the portable way to get INFINITY and NAN is
strtof("infinity", NULL) and strtof("nan", NULL), respectively.

Jeff


More information about the users mailing list