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

Jeffrey Walton noloader at gmail.com
Thu Feb 24 21:15:01 CET 2022


On Thu, Feb 24, 2022 at 3:13 PM İhsan Doğan <ihsan at opencsw.org> wrote:
>
> > Am 24.02.2022 um 21:08 schrieb Jeffrey Walton via users <users at lists.opencsw.org>:
> >>
> >> 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.
>
> Did this patch fix your issue?

Yes, here's what you want:
https://github.com/noloader/Build-Scripts/blob/master/patch/expat.patch.

But it is against libexpat 2.4.5, not OpenCSW's 2.4.4.

Jeff


More information about the users mailing list