GNOME Bugzilla – Bug 652560
Test for g_ascii_strtod is failing
Last modified: 2011-11-30 17:25:11 UTC
Hi, I am compiling glib 2.29.6 on Solaris 9 Sparc with Sun Studio 12 and get the following failing test: ... /strfuncs/strsplit-set: OK /strfuncs/strv-length: OK /strfuncs/strtod: ** ERROR **: g_ascii_strtod on "0xa.b" for locale sv_SE failed expected 10.687500 (nan 0) actual 0.000000 (nan 0) FAIL GTester: last random seed: R02Se204602229b501ff9954ce78cae4da21 gmake[6]: *** [test-nonrecursive] Error 143
Looks like the strtod() in your libc does not support hex floats ?
This is correct for Solaris 9. There should be support in Solaris 10 (from strtod(3c)): The expected form of the subject sequence is an optional plus or minus sign, then one of the following: ... o A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional binary exponent part However, the test is failing on Solaris 10 also.
Solaris 10 seems to need explicitly need -xc99 with Sun Studio 12.
Although Dagobert is right, there are two problems here. 1) I don't think the test should abort(). It should *fail*, but it shouldn't abort. The problem with abort() is that all the remaining tests are therefore skipped, which likely isn't the desired behavior. 2) If you configure glib with -xc99 (which is the same as -xc99=all) as part of CFLAGS, then configure actually fails: checking for res_query... in -lresolv checking number of arguments to statfs()... unknown configure: error: unable to determine number of arguments to statfs() From config.log: configure:23525: checking number of arguments to statfs() configure:23551: cc -c -Xa -xc99=all -xO3 -mt -features=extensions -KPIC -xtarget=native -m64 -xarch=native -I/local/gnu/include -I/local/gnu/include -I/local/include -I/local/gnu/include -I/local/gnu/include -I/local/include -DG_DISABLE_SINGLE_INCLUDES conftest.c >&5 "/usr/include/sys/feature_tests.h", line 332: #error: "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications" cc: acomp failed for conftest.c configure:23551: $? = 2 The problem is that configure has this code in it: case $host in *-*-solaris* ) AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Needed to get declarations for msg_control and msg_controllen on Solaris) AC_DEFINE(_XOPEN_SOURCE, 2, Needed to get declarations for msg_control and msg_controllen on Solaris) AC_DEFINE(__EXTENSIONS__, 1, Needed to get declarations for msg_control and msg_controllen on Solaris) ;; esac and at least one of those defines is incompatible with -xc99=all. Based on my reading of the standards(5) man page on Solaris 10, it appears that for C99, we probably want _XOPEN_SOURCE_EXTENDED undefined, since that puts that system at XPG4v2, and we want _XOPEN_SOURCE=500 or _XOPEN_SOURCE=600, since that's SUSv2 or SUSv3, respectively. I have a patch for that and with one other minor patch glib 2.28.8 will compile and the failing test now passes, but setting _XOPEN_SOURCE=600 also requires that -xc99=all be specified, and I don't know what that means for programs that link against glib, i.e. do they *also* need -xc99=all?
The following fix has been pushed: b13e79d Don't abort if g_ascii_strtod tests fail
Created attachment 202421 [details] [review] Don't abort if g_ascii_strtod tests fail
Thanks Matthias. Your work on this is appreciated.